Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutksefpt committed May 1, 2020
1 parent 30567db commit b298a23
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,11 @@ public void onChangeLandUnit() {
if (landUnit == null) {
landUnit = RealEstateTypeConstant.UNIT;
}
getHintLandUnit();
List<String> dataRangeLand = getHintLandDataRange();
if(dataRangeLand != null && !dataRangeLand.isEmpty()){
PrimeFaces.current().executeScript("loadLandDataRange('" + dataRangeLand + "')");
}

PrimeFaces.current().executeScript("loadLandUnit('" + landUnit + "')");

}
Expand All @@ -593,7 +597,10 @@ public void onChangeHouseUnit() {
if (houseUnit == null) {
houseUnit = RealEstateTypeConstant.UNIT;
}
getHintHouseUnit();
List<String> dataRangeHouse = getHintHouseDataRange();
if(dataRangeHouse != null && !dataRangeHouse.isEmpty()){
PrimeFaces.current().executeScript("loadHouseDataRange('" + dataRangeHouse + "')");
}
PrimeFaces.current().executeScript("loadHouseUnit('" + houseUnit + "')");
}

Expand Down Expand Up @@ -681,9 +688,8 @@ public void addNewHousesFeatureValue() {

}

public void getHintLandUnit(){
if (!checkLandFeatureExisted(landFeatureIdSelected, listLandFeatureValue)) {
for (int i = 0; i < listLandFeatureValue.size(); i++) {
public List<String> getHintLandDataRange(){
for (int i = 0; i < listLandsFeature.size(); i++) {

if (landFeatureIdSelected.equals(listLandsFeature.get(i).getLandsFeatureID().toString())) {
// xử lý data range ở đây
Expand All @@ -695,17 +701,17 @@ public void getHintLandUnit(){
break;
}
}
housesFeatureDataRangeClicked = test.getLandsFeatureDataRange();
landsFeatureDataRangeClicked = test.getLandsFeatureDataRange();
break;
}
}

}
return landsFeatureDataRangeClicked;



}

public void getHintHouseUnit(){
if (!checkHouseFeatureExisted(houseFeatureIdSelected, listHouseFeatureValue)) {
public List<String> getHintHouseDataRange(){
for (int i = 0; i < listHousesFeature.size(); i++) {

if (houseFeatureIdSelected.equals(listHousesFeature.get(i).getHousesFeatureID().toString())) {
Expand All @@ -722,9 +728,7 @@ public void getHintHouseUnit(){
break;
}
}

}

return housesFeatureDataRangeClicked;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ public void onChangeLandUnit() {
if (landUnit == null) {
landUnit = RealEstateTypeConstant.UNIT;
}
getHintLandUnit();
List<String> dataRangeLand = getHintLandDataRange();
if(dataRangeLand != null && !dataRangeLand.isEmpty()){
PrimeFaces.current().executeScript("loadLandDataRange('" + dataRangeLand + "')");
}

PrimeFaces.current().executeScript("loadLandUnit('" + landUnit + "')");

}
Expand All @@ -607,35 +611,62 @@ public void onChangeHouseUnit() {
if (houseUnit == null) {
houseUnit = RealEstateTypeConstant.UNIT;
}
getHintHouseUnit();
List<String> dataRangeHouse = getHintHouseDataRange();
if(dataRangeHouse != null && !dataRangeHouse.isEmpty()){
PrimeFaces.current().executeScript("loadHouseDataRange('" + dataRangeHouse + "')");
}
PrimeFaces.current().executeScript("loadHouseUnit('" + houseUnit + "')");
}


public void getHintLandUnit(){
if (!checkHouseFeatureExisted(houseFeatureIdSelected, listHouseFeatureValue)) {
for (int i = 0; i < listHousesFeature.size(); i++) {

if (houseFeatureIdSelected.equals(listHousesFeature.get(i).getHousesFeatureID().toString())) {
public void addNewLandFeatureValue() {
if (!checkLandFeatureExisted(landFeatureIdSelected, listLandFeatureValue)) {
for (int i = 0; i < listLandsFeature.size(); i++) {

if (landFeatureIdSelected.equals(listLandsFeature.get(i).getLandsFeatureID().toString())) {
// xử lý data range ở đây
List<HousesFeature> temp = housesFeatureService.findAll();
HousesFeature test = new HousesFeature();
List<LandsFeature> temp = landFeatureService.findAll();
LandsFeature test = new LandsFeature();
for (int j = 0; j < temp.size(); j++) {
if (temp.get(j).getHousesFeatureID().toString().equals(houseFeatureIdSelected)) {
if (temp.get(j).getLandsFeatureID().toString().equals(landFeatureIdSelected)) {
test = temp.get(j);
break;
}
}
housesFeatureDataRangeClicked = test.getHousesFeatureDataRange();
break;
landsFeatureDataRangeClicked = test.getLandsFeatureDataRange();
if (landsFeatureDataRangeClicked.isEmpty()) {
listLandFeatureValue.add(new LandFeatureValue(listLandsFeature.get(i), newLandFeatureValue));
} else if(newLandFeatureValue == null || newLandFeatureValue.isEmpty()){
PrimeFaces.current().executeScript("emptyDataAdd()");
}else {
if (checkDataRange(landsFeatureDataRangeClicked, newLandFeatureValue)) {
listLandFeatureValue.add(new LandFeatureValue(listLandsFeature.get(i), newLandFeatureValue));
} else {
PrimeFaces.current().executeScript("showLogDataRange()");
}
}

}
}

} else {
// show log
PrimeFaces.current().executeScript("landFeatureExisted()");
}

}

public void getHintHouseUnit(){

public boolean checkDataRange(List<String> featureDataRangeClicked, String dataCheck) {
boolean test = false;
for (int i = 0; i < featureDataRangeClicked.size(); i++) {
if (featureDataRangeClicked.get(i).trim().equals(dataCheck.trim())) {
test = true;
break;
}
}
return test;
}

public void addNewHousesFeatureValue() {
if (!checkHouseFeatureExisted(houseFeatureIdSelected, listHouseFeatureValue)) {
for (int i = 0; i < listHousesFeature.size(); i++) {

Expand All @@ -650,58 +681,72 @@ public void getHintHouseUnit(){
}
}
housesFeatureDataRangeClicked = test.getHousesFeatureDataRange();
break;
if (housesFeatureDataRangeClicked.isEmpty()) {
listHouseFeatureValue.add(new HouseFeatureValue(listHousesFeature.get(i), newHouseFeatureValue));
} else if(newHouseFeatureValue == null || newHouseFeatureValue.isEmpty()){
PrimeFaces.current().executeScript("emptyDataAdd()");
}else {
if (checkDataRange(housesFeatureDataRangeClicked, newHouseFeatureValue)) {
// check data range ok ko ?
listHouseFeatureValue.add(new HouseFeatureValue(listHousesFeature.get(i), newHouseFeatureValue));
} else {
PrimeFaces.current().executeScript("showLogDataRange()");
}
}
}
}

} else {
PrimeFaces.current().executeScript("houseFeatureExisted()");
}



}


public boolean checkDataRange(List<String> featureDataRangeClicked, String dataCheck) {
boolean test = false;
for (int i = 0; i < featureDataRangeClicked.size(); i++) {
if (featureDataRangeClicked.get(i).trim().equals(dataCheck.trim())) {
test = true;
break;
}
}
return test;
}


public void addNewLandFeatureValue() {
if (!checkLandFeatureExisted(landFeatureIdSelected, listLandFeatureValue)) {
for (int i = 0; i < listLandsFeature.size(); i++) {
public List<String> getHintLandDataRange(){
for (int i = 0; i < listLandsFeature.size(); i++) {

if (landFeatureIdSelected.equals(listLandsFeature.get(i).getLandsFeatureID().toString())) {
listLandFeatureValue.add(new LandFeatureValue(listLandsFeature.get(i), newLandFeatureValue));
// xử lý data range ở đây
List<LandsFeature> temp = landFeatureService.findAll();
LandsFeature test = new LandsFeature();
for (int j = 0; j < temp.size(); j++) {
if (temp.get(j).getLandsFeatureID().toString().equals(landFeatureIdSelected)) {
test = temp.get(j);
break;
}
}
landsFeatureDataRangeClicked = test.getLandsFeatureDataRange();
break;
}
}

} else {
// show log
PrimeFaces.current().executeScript("landFeatureExisted()");
}

return landsFeatureDataRangeClicked;



}

public void addNewHousesFeatureValue() {
if (!checkHouseFeatureExisted(houseFeatureIdSelected, listHouseFeatureValue)) {

public List<String> getHintHouseDataRange(){
for (int i = 0; i < listHousesFeature.size(); i++) {

if (houseFeatureIdSelected.equals(listHousesFeature.get(i).getHousesFeatureID().toString())) {
listHouseFeatureValue.add(new HouseFeatureValue(listHousesFeature.get(i), newHouseFeatureValue));
// xử lý data range ở đây
List<HousesFeature> temp = housesFeatureService.findAll();
HousesFeature test = new HousesFeature();
for (int j = 0; j < temp.size(); j++) {
if (temp.get(j).getHousesFeatureID().toString().equals(houseFeatureIdSelected)) {
test = temp.get(j);
break;
}
}
housesFeatureDataRangeClicked = test.getHousesFeatureDataRange();
break;
}
}

} else {
PrimeFaces.current().executeScript("houseFeatureExisted()");
}

return housesFeatureDataRangeClicked;

}



public boolean checkLandFeatureExisted(String landFeatureIdChecking, List<LandFeatureValue> listLandFeatureValue) {
for (LandFeatureValue i : listLandFeatureValue) {
Expand Down
7 changes: 1 addition & 6 deletions src/main/webapp/resources/css/contributenewrealestate.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,7 @@ html {
box-sizing: border-box;
margin-top: 25px;
}
.landbox{
margin-right: 5px;
}
.housebox{
margin-left: 5px;
}

.landboxTotal , .houseboxTotal {
border-radius: 3px;
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/resources/js/contributenewrealestate.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ function loadLandUnit(landUnit) {
document.getElementById("landUnit").textContent = landUnit ;
}

function loadLandDataRange(dataRange) {
document.getElementById("landDataRange").textContent = "Ví dụ: " + dataRange ;
}

function loadHouseDataRange(dataRange) {
document.getElementById("houseDataRange").textContent = "Ví dụ: " + dataRange ;
}

function loadHouseUnit(houseUnit) {
document.getElementById("houseUnit").textContent = houseUnit;
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/resources/js/updatecontributerealestate.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ function showLogDataRange (){
alert("Vui lòng điền giá trị thuộc tính phù hợp theo mẫu");
}

function loadLandDataRange(dataRange) {
document.getElementById("landDataRange").textContent = "Ví dụ: " + dataRange ;
}

function loadHouseDataRange(dataRange) {
document.getElementById("houseDataRange").textContent = "Ví dụ: " + dataRange ;
}

function showModalMandatory() {
tempRealEstateName = $('#msform\\:realEstateName').val();
tempRealEstateValue = $('#msform\\:realEstatePrice').val();
Expand Down
Loading

0 comments on commit b298a23

Please sign in to comment.