Injury form changes in model
parent
b08932e0f6
commit
ba7ae22220
|
@ -75,6 +75,7 @@ public class InjuryFormOne extends AppCompatActivity {
|
|||
return;
|
||||
}
|
||||
loginViewModel.getDailyWageWorkerData(etEmpId.getText().toString());
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("DailyWageWorker");
|
||||
}
|
||||
else {
|
||||
if (etEmpId.getText().toString().isEmpty()) {
|
||||
|
@ -82,6 +83,7 @@ public class InjuryFormOne extends AppCompatActivity {
|
|||
return;
|
||||
}
|
||||
loginViewModel.getEmployeeData(etEmpId.getText().toString());
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerType("Employee/Contractor-Worker");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -91,7 +93,7 @@ public class InjuryFormOne extends AppCompatActivity {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isValidate()) {
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setEmployeeId(Integer.parseInt(etEmpId.getText().toString()));
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setWorkerId(Integer.parseInt(etEmpId.getText().toString()));
|
||||
Intent intent = new Intent(InjuryFormOne.this, InjuryFormTwo.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
|
|
@ -17,12 +17,10 @@ import androidx.core.view.ViewCompat;
|
|||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.utopiaindustries.hseobservationsapp.R;
|
||||
import com.utopiaindustries.hseobservationsapp.activities.ObservationForms.ObservationOneActivity;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.BodyPartAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.IncidentTypeAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.InjuryTypeAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.KpiAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.ObservationSubClassAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.PersonalIllnessAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.adapters.ShiftAdapter;
|
||||
import com.utopiaindustries.hseobservationsapp.helper.Helper;
|
||||
|
@ -31,8 +29,6 @@ import com.utopiaindustries.hseobservationsapp.models.HseData.HseInjuredBodyPart
|
|||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseInjury;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseInjuryType;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseKpi;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationClass;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.HseObservationSubClass;
|
||||
import com.utopiaindustries.hseobservationsapp.models.HseData.Shift;
|
||||
import com.utopiaindustries.hseobservationsapp.utils.StorageManager.StorageManager;
|
||||
|
||||
|
@ -113,7 +109,8 @@ public class InjuryFormTwo extends AppCompatActivity {
|
|||
|
||||
kpiTextview.setOnItemClickListener((v, position, id, item) -> {
|
||||
kpi = kpiArrayList.get(id).getTitle();
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setKpi(kpi);
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setKpiId(kpiArrayList.get(id).getId());
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setKpiName(kpi);
|
||||
});
|
||||
|
||||
incidentTypeTextview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
@ -121,7 +118,7 @@ public class InjuryFormTwo extends AppCompatActivity {
|
|||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
HseIncidentType clickedItem = incidentTypeArrayList.get(position);
|
||||
int selectedId = clickedItem.getId();
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setIncidentTypeId(selectedId);
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setIncidentId(selectedId);
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setIncidentTypeName(clickedItem.getTitle());
|
||||
//Near Miss = 1, Property Damage = 2, Fire = 5, RTA = 6
|
||||
//Personal Illness = 4
|
||||
|
@ -199,7 +196,7 @@ public class InjuryFormTwo extends AppCompatActivity {
|
|||
});
|
||||
|
||||
riskTypeTextview.setOnItemClickListener((v, position, id, item) -> {
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setRiskTypeName(riskTypeArrayList.get(id).getTitle());
|
||||
StorageManager.getInstance().getInjuryRecordModel().get(0).setRiskLevel(riskTypeArrayList.get(id).getTitle());
|
||||
});
|
||||
|
||||
btnNext.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -292,19 +289,19 @@ public class InjuryFormTwo extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void showPersistData() {
|
||||
kpiTextview.post(() -> kpiTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getKpi(), false));
|
||||
kpiTextview.post(() -> kpiTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getKpiName(), false));
|
||||
incidentTypeTextview.post(() -> incidentTypeTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getIncidentTypeName(), false));
|
||||
personalIllnessTextview.post(() -> personalIllnessTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getAccidentTypeName(), false));
|
||||
injuryTypeTextview.post(() -> injuryTypeTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getInjuryTypeName(), false));
|
||||
bodyPartTextview.post(() -> bodyPartTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getBodyPartName(), false));
|
||||
riskTypeTextview.post(() -> riskTypeTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getRiskTypeName(), false));
|
||||
riskTypeTextview.post(() -> riskTypeTextview.setText(StorageManager.getInstance().getInjuryRecordModel().get(0).getRiskLevel(), false));
|
||||
|
||||
showLayouts();
|
||||
|
||||
if (!personalIllnessArrayList_temp.isEmpty()) {
|
||||
|
||||
List<HseInjury> filteredUnitItems = personalIllnessArrayList_temp.stream()
|
||||
.filter(item -> Objects.equals(item.getIncidentId(), StorageManager.getInstance().getInjuryRecordModel().get(0).getIncidentTypeId()))
|
||||
.filter(item -> Objects.equals(item.getIncidentId(), StorageManager.getInstance().getInjuryRecordModel().get(0).getIncidentId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
personalIllnessArrayList.clear();
|
||||
|
|
|
@ -3,12 +3,18 @@ package com.utopiaindustries.hseobservationsapp.utils.StorageManager;
|
|||
import java.util.List;
|
||||
|
||||
public class InjuryRecordModel {
|
||||
private int employeeId;
|
||||
private String Kpi;
|
||||
private int workerId;
|
||||
private String workerType;
|
||||
|
||||
private int incidentTypeId;
|
||||
private int kpiId;
|
||||
private String KpiName;
|
||||
|
||||
private int incidentId;
|
||||
private String incidentTypeName;
|
||||
|
||||
private int injuryId;
|
||||
private String injuryName;
|
||||
|
||||
private int accidentTypeId;
|
||||
private String accidentTypeName;
|
||||
|
||||
|
@ -18,27 +24,27 @@ public class InjuryRecordModel {
|
|||
private int bodyPartId;
|
||||
private String bodyPartName;
|
||||
|
||||
private int riskTypeId;
|
||||
private String riskTypeName;
|
||||
private int riskLevelId;
|
||||
private String riskLevel;
|
||||
|
||||
private String description;
|
||||
|
||||
private List<byte[]> pictures;
|
||||
|
||||
public int getEmployeeId() {
|
||||
return employeeId;
|
||||
public int getWorkerId() {
|
||||
return workerId;
|
||||
}
|
||||
|
||||
public void setEmployeeId(int employeeId) {
|
||||
this.employeeId = employeeId;
|
||||
public void setWorkerId(int workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public String getKpi() {
|
||||
return Kpi;
|
||||
public String getKpiName() {
|
||||
return KpiName;
|
||||
}
|
||||
|
||||
public void setKpi(String kpi) {
|
||||
Kpi = kpi;
|
||||
public void setKpiName(String kpiName) {
|
||||
KpiName = kpiName;
|
||||
}
|
||||
|
||||
public int getBodyPartId() {
|
||||
|
@ -81,12 +87,12 @@ public class InjuryRecordModel {
|
|||
this.pictures = pictures;
|
||||
}
|
||||
|
||||
public int getIncidentTypeId() {
|
||||
return incidentTypeId;
|
||||
public int getIncidentId() {
|
||||
return incidentId;
|
||||
}
|
||||
|
||||
public void setIncidentTypeId(int incidentTypeId) {
|
||||
this.incidentTypeId = incidentTypeId;
|
||||
public void setIncidentId(int incidentId) {
|
||||
this.incidentId = incidentId;
|
||||
}
|
||||
|
||||
public String getIncidentTypeName() {
|
||||
|
@ -113,20 +119,20 @@ public class InjuryRecordModel {
|
|||
this.accidentTypeName = accidentTypeName;
|
||||
}
|
||||
|
||||
public int getRiskTypeId() {
|
||||
return riskTypeId;
|
||||
public int getRiskLevelId() {
|
||||
return riskLevelId;
|
||||
}
|
||||
|
||||
public void setRiskTypeId(int riskTypeId) {
|
||||
this.riskTypeId = riskTypeId;
|
||||
public void setRiskLevelId(int riskLevelId) {
|
||||
this.riskLevelId = riskLevelId;
|
||||
}
|
||||
|
||||
public String getRiskTypeName() {
|
||||
return riskTypeName;
|
||||
public String getRiskLevel() {
|
||||
return riskLevel;
|
||||
}
|
||||
|
||||
public void setRiskTypeName(String riskTypeName) {
|
||||
this.riskTypeName = riskTypeName;
|
||||
public void setRiskLevel(String riskLevel) {
|
||||
this.riskLevel = riskLevel;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
@ -137,12 +143,28 @@ public class InjuryRecordModel {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public String getWorkerType() {
|
||||
return workerType;
|
||||
}
|
||||
|
||||
public void setWorkerType(String workerType) {
|
||||
this.workerType = workerType;
|
||||
}
|
||||
|
||||
public int getKpiId() {
|
||||
return kpiId;
|
||||
}
|
||||
|
||||
public void setKpiId(int kpiId) {
|
||||
this.kpiId = kpiId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InjuryRecordModel{" +
|
||||
"employeeId=" + employeeId +
|
||||
", Kpi='" + Kpi + '\'' +
|
||||
", incidentTypeId=" + incidentTypeId +
|
||||
"employeeId=" + workerId +
|
||||
", Kpi='" + KpiName + '\'' +
|
||||
", incidentTypeId=" + incidentId +
|
||||
", incidentTypeName='" + incidentTypeName + '\'' +
|
||||
", accidentTypeId=" + accidentTypeId +
|
||||
", accidentTypeName='" + accidentTypeName + '\'' +
|
||||
|
@ -150,8 +172,8 @@ public class InjuryRecordModel {
|
|||
", injuryTypeName='" + injuryTypeName + '\'' +
|
||||
", bodyPartId=" + bodyPartId +
|
||||
", bodyPartName='" + bodyPartName + '\'' +
|
||||
", riskTypeId=" + riskTypeId +
|
||||
", riskTypeName='" + riskTypeName + '\'' +
|
||||
", riskTypeId=" + riskLevelId +
|
||||
", riskTypeName='" + riskLevel + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", pictures=" + pictures +
|
||||
'}';
|
||||
|
|
Loading…
Reference in New Issue