Add is_active param to Fetch Product API

Add Floor text field
Add status dropdown
main
saad.siddiq 2025-03-20 09:51:13 +05:00
parent 262e578ed8
commit 102b6df66f
7 changed files with 124 additions and 42 deletions

View File

@ -89,7 +89,9 @@ public interface ApiService {
Call<List<ItemUnit>> fetchItemUnits();
@GET( "rest/uic/cosmos-products/" )
Call<List<Product>> fetchAllProducts();
Call<List<Product>> fetchAllProducts(
@Query("is-active") boolean isActive
);
@GET( "rest/uic/inspection-report/inspection-sku-checkpoints" )
Call<List<InspectionCheckpointSku>> fetchSkuCheckpoints( );

View File

@ -22,6 +22,7 @@ public class InspectionReport implements Serializable {
private String qualityAuditor;
private String productionRepresentative;
private String qcRepresentative;
private String floor;
// wrapper
List<InspectionReportItem> items;
@ -113,6 +114,14 @@ public class InspectionReport implements Serializable {
this.reportResult = reportResult;
}
public String getFloor() {
return floor;
}
public void setFloor(String floor) {
this.floor = floor;
}
public List<InspectionReportItem> getItems() {
return items;
}
@ -182,6 +191,7 @@ public class InspectionReport implements Serializable {
", departmentId=" + departmentId +
", functionId=" + functionId +
", generalRemarks='" + generalRemarks + '\'' +
", floor='" + floor + '\'' +
", reportResult='" + reportResult + '\'' +
", qualityAuditor='" + qualityAuditor + '\'' +
", productionRepresentative='" + productionRepresentative + '\'' +

View File

@ -323,7 +323,7 @@ public class InspectionReportService {
private void populateProducts( SaveProductCallBack callback,
ProductRepository repository ){
apiService.fetchAllProducts().enqueue(
apiService.fetchAllProducts(true).enqueue(
new Callback<List<Product>>() {
@Override
public void onResponse(Call<List<Product>> call,

View File

@ -67,11 +67,11 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
private InspectionReportService inspectionReportService;
private RecyclerView vocRecyclerView,itemDimensionsRecyclerView;
private Store store;
//private Spinner resultSpinner;
private Spinner resultSpinner;
private ApiService apiService;
private EditText generalRemarks, etQualityAuditor, etProdRepresentative, etQcRepresentative;
private EditText generalRemarks, etQualityAuditor, etProdRepresentative, etQcRepresentative,etFloor;
private TextView minorCountTv,majorCountTv,criticalCountTv, resultStatus, txtMajor, txtMinor;
private TextView minorCountTv,majorCountTv,criticalCountTv, txtMajor, txtMinor;
@Nullable
@Override
@ -131,6 +131,27 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
}
});
etFloor.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
try {
store.getReport().setFloor( s.toString() );
} catch ( Exception e ){
store.getReport().setFloor( "");
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
etProdRepresentative.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -362,15 +383,12 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
etQualityAuditor.setText(store.getReport().getQualityAuditor());
etProdRepresentative.setText(store.getReport().getProductionRepresentative());
etQcRepresentative.setText(store.getReport().getQcRepresentative());
etFloor.setText(store.getReport().getFloor());
/*ArrayAdapter<String> adapter = new ArrayAdapter<>( getContext(),
ArrayAdapter<String> adapter = new ArrayAdapter<>( getContext(),
android.R.layout.simple_spinner_item,
inspectionReportService.getReportResult() );
resultSpinner.setAdapter( adapter );*/
/*String defaultSelection = store.getReport().getReportResult();
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection );
resultSpinner.setSelection( defaultIndexResultIndex );
resultSpinner.setAdapter( adapter );
resultSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@ -383,7 +401,7 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
public void onNothingSelected(AdapterView<?> parent) {
}
});*/
});
minorCountTv.setText( String.valueOf(0) );
majorCountTv.setText( String.valueOf(0) ) ;
@ -423,20 +441,26 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
if((double) minor <= minorInspection
&& (double) major <= majorInspection
&& (double) crirical == 0) {
resultStatus.setText("PASSED");
//resultStatus.setText("PASSED");
String defaultSelection = "PASSED";
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection );
resultSpinner.setSelection( defaultIndexResultIndex );
store.getReport().setReportResult("PASSED");
resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.success));
//resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.success));
//resultStatus.setBackgroundResource( R.drawable.passed_bg );
}
else{
resultStatus.setText("FAILED");
resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.red));
//resultStatus.setText("FAILED");
//resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.red));
String defaultSelection = "FAILED";
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection );
resultSpinner.setSelection( defaultIndexResultIndex );
store.getReport().setReportResult("FAILED");
//resultStatus.setBackgroundResource( R.drawable.failed_bg );
}
Log.e("majorCount: ",""+majorInspection);
Log.e("minorCount: ",""+minorInspection);
//Log.e("majorCount: ",""+majorInspection);
//Log.e("minorCount: ",""+minorInspection);
txtMajor.setText(String.format("Major : %s/%d", (int)majorInspection, (int)(majorInspection + 1)));
txtMinor.setText(String.format("Minor : %s/%d", (int)minorInspection, (int)(minorInspection + 1)));
}
@ -502,8 +526,8 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
profileImage = view.findViewById( R.id.third_step_profile_image );
profileName = view.findViewById( R.id.third_profile_name );
vocRecyclerView = view.findViewById( R.id.voc_recyclerview );
// resultSpinner = view.findViewById( R.id.result_spinner );
resultStatus = view.findViewById( R.id.result_status);
resultSpinner = view.findViewById( R.id.result_spinner );
//resultStatus = view.findViewById( R.id.result_status);
generalRemarks = view.findViewById( R.id.general_remarks );
itemDimensionsRecyclerView = view.findViewById( R.id.item_dimensions_recyclerview );
minorCountTv = view.findViewById( R.id.minor_count );
@ -514,6 +538,7 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
etQcRepresentative = view.findViewById(R.id.et_qc_represent);
txtMajor = view.findViewById(R.id.txt_major);
txtMinor = view.findViewById(R.id.txt_minor);
etFloor = view.findViewById(R.id.et_floor);
}
private void setOnClickListeners(){

View File

@ -241,6 +241,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/box_border"
android:layout_margin="5dp"
android:orientation="vertical">
<LinearLayout
@ -421,7 +422,7 @@
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="1">
<LinearLayout
@ -517,7 +518,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_marginTop="6dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/box_border"
android:orientation="vertical">
@ -604,7 +610,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="6dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="@drawable/box_border"
android:orientation="vertical">

View File

@ -335,20 +335,20 @@
android:orientation="horizontal"
android:padding="10dp">
<TextView
<!--<TextView
android:id="@+id/result_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:textSize="16sp"
android:textStyle="bold"
android:hint="Result Status" />
<!--<Spinner
android:hint="Result Status" />-->
<Spinner
android:id="@+id/result_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:prompt="@string/spinner_title" />-->
android:layout_weight="0.8"
android:prompt="@string/spinner_title" />
<TextView
android:id="@+id/major_count"
@ -515,9 +515,16 @@
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/box_border"
android:orientation="vertical"
android:orientation="horizontal"
android:weightSum="1"
android:padding="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="0.6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -535,6 +542,33 @@
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="0.4">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Floor"
android:textColor="@color/black"
android:textStyle="bold" />
<EditText
android:id="@+id/et_floor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:hint="Floor"
android:imeOptions="actionDone"
android:inputType="text" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"