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