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(); Call<List<ItemUnit>> fetchItemUnits();
@GET( "rest/uic/cosmos-products/" ) @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" ) @GET( "rest/uic/inspection-report/inspection-sku-checkpoints" )
Call<List<InspectionCheckpointSku>> fetchSkuCheckpoints( ); Call<List<InspectionCheckpointSku>> fetchSkuCheckpoints( );

View File

@ -19,7 +19,7 @@ import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClient { public class RetrofitClient {
private final static String BASE_URL = "https://portal.utopiaindustries.pk/uind/"; private final static String BASE_URL = "https://portal.utopiaindustries.pk/uind/";
//private final static String BASE_URL = "http://192.168.91.44:8081/uind/";//"http://192.168.91.44:8081/uind/";//"http://192.168.90.27:8080/uind/";//"http://192.168.91.16:8080/uind/"; //private final static String BASE_URL = "http://192.168.91.44:8081/uind/";//"http://192.168.91.44:8081/uind/";//"http://192.168.90.27:8080/uind/";//"http://192.168.91.16:8080/uind/";
private static Retrofit retrofit; private static Retrofit retrofit;

View File

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

View File

@ -323,7 +323,7 @@ public class InspectionReportService {
private void populateProducts( SaveProductCallBack callback, private void populateProducts( SaveProductCallBack callback,
ProductRepository repository ){ ProductRepository repository ){
apiService.fetchAllProducts().enqueue( apiService.fetchAllProducts(true).enqueue(
new Callback<List<Product>>() { new Callback<List<Product>>() {
@Override @Override
public void onResponse(Call<List<Product>> call, 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 InspectionReportService inspectionReportService;
private RecyclerView vocRecyclerView,itemDimensionsRecyclerView; private RecyclerView vocRecyclerView,itemDimensionsRecyclerView;
private Store store; private Store store;
//private Spinner resultSpinner; private Spinner resultSpinner;
private ApiService apiService; 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 @Nullable
@Override @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() { etProdRepresentative.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { 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()); etQualityAuditor.setText(store.getReport().getQualityAuditor());
etProdRepresentative.setText(store.getReport().getProductionRepresentative()); etProdRepresentative.setText(store.getReport().getProductionRepresentative());
etQcRepresentative.setText(store.getReport().getQcRepresentative()); 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, android.R.layout.simple_spinner_item,
inspectionReportService.getReportResult() ); inspectionReportService.getReportResult() );
resultSpinner.setAdapter( adapter );*/ resultSpinner.setAdapter( adapter );
/*String defaultSelection = store.getReport().getReportResult();
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection );
resultSpinner.setSelection( defaultIndexResultIndex );
resultSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { resultSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
@ -383,7 +401,7 @@ public class ThirdStepFragment extends Fragment implements View.OnClickListener
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
} }
});*/ });
minorCountTv.setText( String.valueOf(0) ); minorCountTv.setText( String.valueOf(0) );
majorCountTv.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 if((double) minor <= minorInspection
&& (double) major <= majorInspection && (double) major <= majorInspection
&& (double) crirical == 0) { && (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"); 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 ); //resultStatus.setBackgroundResource( R.drawable.passed_bg );
} }
else{ else{
resultStatus.setText("FAILED"); //resultStatus.setText("FAILED");
resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.red)); //resultStatus.setTextColor(ContextCompat.getColor(requireContext(),R.color.red));
String defaultSelection = "FAILED";
int defaultIndexResultIndex = inspectionReportService.getReportResult().indexOf( defaultSelection );
resultSpinner.setSelection( defaultIndexResultIndex );
store.getReport().setReportResult("FAILED"); store.getReport().setReportResult("FAILED");
//resultStatus.setBackgroundResource( R.drawable.failed_bg ); //resultStatus.setBackgroundResource( R.drawable.failed_bg );
} }
Log.e("majorCount: ",""+majorInspection); //Log.e("majorCount: ",""+majorInspection);
Log.e("minorCount: ",""+minorInspection); //Log.e("minorCount: ",""+minorInspection);
txtMajor.setText(String.format("Major : %s/%d", (int)majorInspection, (int)(majorInspection + 1))); txtMajor.setText(String.format("Major : %s/%d", (int)majorInspection, (int)(majorInspection + 1)));
txtMinor.setText(String.format("Minor : %s/%d", (int)minorInspection, (int)(minorInspection + 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 ); profileImage = view.findViewById( R.id.third_step_profile_image );
profileName = view.findViewById( R.id.third_profile_name ); profileName = view.findViewById( R.id.third_profile_name );
vocRecyclerView = view.findViewById( R.id.voc_recyclerview ); vocRecyclerView = view.findViewById( R.id.voc_recyclerview );
// resultSpinner = view.findViewById( R.id.result_spinner ); resultSpinner = view.findViewById( R.id.result_spinner );
resultStatus = view.findViewById( R.id.result_status); //resultStatus = view.findViewById( R.id.result_status);
generalRemarks = view.findViewById( R.id.general_remarks ); generalRemarks = view.findViewById( R.id.general_remarks );
itemDimensionsRecyclerView = view.findViewById( R.id.item_dimensions_recyclerview ); itemDimensionsRecyclerView = view.findViewById( R.id.item_dimensions_recyclerview );
minorCountTv = view.findViewById( R.id.minor_count ); 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); etQcRepresentative = view.findViewById(R.id.et_qc_represent);
txtMajor = view.findViewById(R.id.txt_major); txtMajor = view.findViewById(R.id.txt_major);
txtMinor = view.findViewById(R.id.txt_minor); txtMinor = view.findViewById(R.id.txt_minor);
etFloor = view.findViewById(R.id.et_floor);
} }
private void setOnClickListeners(){ private void setOnClickListeners(){

View File

@ -241,6 +241,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/box_border" android:background="@drawable/box_border"
android:layout_margin="5dp"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@ -421,7 +422,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="5dp"
android:weightSum="1"> android:weightSum="1">
<LinearLayout <LinearLayout
@ -517,7 +518,12 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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:background="@drawable/box_border"
android:orientation="vertical"> android:orientation="vertical">
@ -604,7 +610,12 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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:background="@drawable/box_border"
android:orientation="vertical"> android:orientation="vertical">

View File

@ -335,20 +335,20 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="10dp"> android:padding="10dp">
<TextView <!--<TextView
android:id="@+id/result_status" android:id="@+id/result_status"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.8" android:layout_weight="0.8"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
android:hint="Result Status" /> android:hint="Result Status" />-->
<!--<Spinner <Spinner
android:id="@+id/result_spinner" android:id="@+id/result_spinner"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="0.8"
android:prompt="@string/spinner_title" />--> android:prompt="@string/spinner_title" />
<TextView <TextView
android:id="@+id/major_count" android:id="@+id/major_count"
@ -515,24 +515,58 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
android:background="@drawable/box_border" android:background="@drawable/box_border"
android:orientation="vertical" android:orientation="horizontal"
android:weightSum="1"
android:padding="5dp"> android:padding="5dp">
<TextView <LinearLayout
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:orientation="vertical"
android:text="General Remarks" android:layout_weight="0.6">
android:textColor="@color/black"
android:textStyle="bold" />
<EditText <TextView
android:id="@+id/general_remarks" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="General Remarks"
android:textColor="@color/black"
android:textStyle="bold" />
<EditText
android:id="@+id/general_remarks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:hint="General Remarks"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp" android:orientation="vertical"
android:hint="General Remarks" android:layout_weight="0.4">
android:inputType="text" />
<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>
<LinearLayout <LinearLayout