Employee Info and daily wage worker info API changes and validations added
parent
d0e3d1c74f
commit
b0d2fae79e
|
@ -69,23 +69,27 @@ public class InjuryFormOne extends AppCompatActivity {
|
||||||
btnFetch.setOnClickListener(new View.OnClickListener() {
|
btnFetch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
if (!etEmpId.getText().toString().isEmpty()) {
|
||||||
if (workerType.equalsIgnoreCase("Visitor")) {
|
if (workerType.equalsIgnoreCase("Visitor")) {
|
||||||
if (etEmpId.getText().toString().isEmpty()) {
|
/*if (etEmpId.getText().toString().isEmpty()) {
|
||||||
Toast.makeText(InjuryFormOne.this, "Please enter visitor id", Toast.LENGTH_SHORT).show();
|
Toast.makeText(InjuryFormOne.this, "Please enter visitor id", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
loginViewModel.getDailyWageWorkerData(etEmpId.getText().toString());
|
loginViewModel.getDailyWageWorkerData(etEmpId.getText().toString());
|
||||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("DailyWageWorker");
|
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("DailyWageWorker");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (etEmpId.getText().toString().isEmpty()) {
|
/*if (etEmpId.getText().toString().isEmpty()) {
|
||||||
Toast.makeText(InjuryFormOne.this, "Please enter employee id", Toast.LENGTH_SHORT).show();
|
Toast.makeText(InjuryFormOne.this, "Please enter employee id", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
loginViewModel.getEmployeeData(etEmpId.getText().toString());
|
loginViewModel.getEmployeeData(etEmpId.getText().toString());
|
||||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("Employee/Contractor-Worker");
|
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("Employee/Contractor-Worker");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(InjuryFormOne.this, "Please enter id", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -109,12 +113,14 @@ public class InjuryFormOne extends AppCompatActivity {
|
||||||
layoutEmployeeInfo.setVisibility(View.VISIBLE);
|
layoutEmployeeInfo.setVisibility(View.VISIBLE);
|
||||||
layoutDailyWageInfo.setVisibility(View.GONE);
|
layoutDailyWageInfo.setVisibility(View.GONE);
|
||||||
txtEmployeeHeading.setText("Employee ID Number *");
|
txtEmployeeHeading.setText("Employee ID Number *");
|
||||||
|
etEmpId.setText("");
|
||||||
workerType = "Employee";
|
workerType = "Employee";
|
||||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("Employee/Contractor-Worker");
|
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("Employee/Contractor-Worker");
|
||||||
} else if (checkedId == R.id.rb_dailyWage) {
|
} else if (checkedId == R.id.rb_dailyWage) {
|
||||||
layoutEmployeeInfo.setVisibility(View.GONE);
|
layoutEmployeeInfo.setVisibility(View.GONE);
|
||||||
layoutDailyWageInfo.setVisibility(View.VISIBLE);
|
layoutDailyWageInfo.setVisibility(View.VISIBLE);
|
||||||
txtEmployeeHeading.setText("Visitor ID *");
|
txtEmployeeHeading.setText("Visitor ID *");
|
||||||
|
etEmpId.setText("");
|
||||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("DailyWageWorker");
|
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("DailyWageWorker");
|
||||||
workerType = "Visitor";
|
workerType = "Visitor";
|
||||||
}
|
}
|
||||||
|
@ -218,11 +224,18 @@ public class InjuryFormOne extends AppCompatActivity {
|
||||||
if (employeeInfoResponse != null) {
|
if (employeeInfoResponse != null) {
|
||||||
Log.e("Employee-Info: ",""+employeeInfoResponse.toString());
|
Log.e("Employee-Info: ",""+employeeInfoResponse.toString());
|
||||||
|
|
||||||
|
if (employeeInfoResponse.getWorkerType() != null) {
|
||||||
etEmployeeName.setText(employeeInfoResponse.getFullName());
|
etEmployeeName.setText(employeeInfoResponse.getFullName());
|
||||||
etEmployeeDesignation.setText(employeeInfoResponse.getPositionTitle());
|
etEmployeeDesignation.setText(employeeInfoResponse.getPositionTitle());
|
||||||
etEmployeeTenure.setText(employeeInfoResponse.getEmployeeTenure());
|
etEmployeeTenure.setText(employeeInfoResponse.getEmployeeTenure());
|
||||||
etDate.setText(employeeInfoResponse.getJoiningDate());
|
etDate.setText(employeeInfoResponse.getJoiningDate());
|
||||||
etEmployeeType.setText(employeeInfoResponse.getWorkerType());
|
etEmployeeType.setText(employeeInfoResponse.getWorkerType());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(this, "Record not found", Toast.LENGTH_SHORT).show();
|
||||||
|
etEmpId.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -230,12 +243,20 @@ public class InjuryFormOne extends AppCompatActivity {
|
||||||
loginViewModel.getDailyWageLiveData().observe(this, dailyWageInfoResponse -> {
|
loginViewModel.getDailyWageLiveData().observe(this, dailyWageInfoResponse -> {
|
||||||
if (dailyWageInfoResponse != null) {
|
if (dailyWageInfoResponse != null) {
|
||||||
Log.e("Daily-Wage-Info: ",""+dailyWageInfoResponse.toString());
|
Log.e("Daily-Wage-Info: ",""+dailyWageInfoResponse.toString());
|
||||||
|
|
||||||
|
if (dailyWageInfoResponse.getLocationSite() != null) {
|
||||||
etName.setText(dailyWageInfoResponse.getName());
|
etName.setText(dailyWageInfoResponse.getName());
|
||||||
etLocationSite.setText(dailyWageInfoResponse.getLocationSite());
|
etLocationSite.setText(dailyWageInfoResponse.getLocationSite());
|
||||||
etCnic.setText(dailyWageInfoResponse.getCnic());
|
etCnic.setText(dailyWageInfoResponse.getCnic());
|
||||||
etContractorName.setText(dailyWageInfoResponse.getContractorName());
|
etContractorName.setText(dailyWageInfoResponse.getContractorName());
|
||||||
etDivision.setText(dailyWageInfoResponse.getDivisionDepartment());
|
etDivision.setText(dailyWageInfoResponse.getDivisionDepartment());
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(this, "Record not found", Toast.LENGTH_SHORT).show();
|
||||||
|
etEmpId.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +284,20 @@ public class InjuryFormOne extends AppCompatActivity {
|
||||||
boolean returnValue = true;
|
boolean returnValue = true;
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
|
if (workerType.equalsIgnoreCase("Visitor")) {
|
||||||
|
if (etName.getText().toString().isEmpty()) {
|
||||||
|
message = "Fetch Record First.";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workerType.equalsIgnoreCase("Employee")) {
|
||||||
|
if (etEmployeeName.getText().toString().isEmpty()) {
|
||||||
|
message = "Fetch Record First.";
|
||||||
|
returnValue = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (etEmpId.getText().toString().isEmpty()) {
|
if (etEmpId.getText().toString().isEmpty()) {
|
||||||
message = "ID is required.";
|
message = "ID is required.";
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
|
|
|
@ -6,13 +6,13 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
public class DailyWageResponse {
|
public class DailyWageResponse {
|
||||||
|
|
||||||
@SerializedName("Location-Site")
|
@SerializedName("Location Site")
|
||||||
@Expose
|
@Expose
|
||||||
private String locationSite;
|
private String locationSite;
|
||||||
@SerializedName("Cnic")
|
@SerializedName("Cnic")
|
||||||
@Expose
|
@Expose
|
||||||
private String cnic;
|
private String cnic;
|
||||||
@SerializedName("Contractor-Name")
|
@SerializedName("Contractor Name")
|
||||||
@Expose
|
@Expose
|
||||||
private String contractorName;
|
private String contractorName;
|
||||||
@SerializedName("Division-Department")
|
@SerializedName("Division-Department")
|
||||||
|
@ -62,4 +62,14 @@ public class DailyWageResponse {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DailyWageResponse{" +
|
||||||
|
"locationSite='" + locationSite + '\'' +
|
||||||
|
", cnic='" + cnic + '\'' +
|
||||||
|
", contractorName='" + contractorName + '\'' +
|
||||||
|
", divisionDepartment='" + divisionDepartment + '\'' +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
android:id="@+id/scrollView2"
|
android:id="@+id/scrollView2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/btn_next"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar">
|
app:layout_constraintTop_toBottomOf="@+id/toolbar">
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:background="@drawable/rounded_btn_login"
|
android:background="@drawable/rounded_btn_login"
|
||||||
android:text="Fetch Emp Data"
|
android:text="Fetch Data"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/_12sdp" />
|
android:textSize="@dimen/_12sdp" />
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<resources>
|
||||||
|
<dimen name="fab_margin">48dp</dimen>
|
||||||
|
</resources>
|
Loading…
Reference in New Issue