diff --git a/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/ApiService.java b/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/ApiService.java index 00dee0a..5218a02 100644 --- a/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/ApiService.java +++ b/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/ApiService.java @@ -89,7 +89,9 @@ public interface ApiService { Call> fetchItemUnits(); @GET( "rest/uic/cosmos-products/" ) - Call> fetchAllProducts(); + Call> fetchAllProducts( + @Query("is-active") boolean isActive + ); @GET( "rest/uic/inspection-report/inspection-sku-checkpoints" ) Call> fetchSkuCheckpoints( ); diff --git a/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/RetrofitClient.java b/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/RetrofitClient.java index 8a6928f..70a96f8 100644 --- a/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/RetrofitClient.java +++ b/app/src/main/java/com/utopiaindustries/qualitychecker/apiservice/RetrofitClient.java @@ -19,7 +19,7 @@ import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; 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 static Retrofit retrofit; diff --git a/app/src/main/java/com/utopiaindustries/qualitychecker/models/InspectionReport.java b/app/src/main/java/com/utopiaindustries/qualitychecker/models/InspectionReport.java index c9b86e3..38d11ea 100644 --- a/app/src/main/java/com/utopiaindustries/qualitychecker/models/InspectionReport.java +++ b/app/src/main/java/com/utopiaindustries/qualitychecker/models/InspectionReport.java @@ -22,6 +22,7 @@ public class InspectionReport implements Serializable { private String qualityAuditor; private String productionRepresentative; private String qcRepresentative; + private String floor; // wrapper List 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 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 + '\'' + diff --git a/app/src/main/java/com/utopiaindustries/qualitychecker/service/InspectionReportService.java b/app/src/main/java/com/utopiaindustries/qualitychecker/service/InspectionReportService.java index 1b08824..a4fc3e0 100644 --- a/app/src/main/java/com/utopiaindustries/qualitychecker/service/InspectionReportService.java +++ b/app/src/main/java/com/utopiaindustries/qualitychecker/service/InspectionReportService.java @@ -323,7 +323,7 @@ public class InspectionReportService { private void populateProducts( SaveProductCallBack callback, ProductRepository repository ){ - apiService.fetchAllProducts().enqueue( + apiService.fetchAllProducts(true).enqueue( new Callback>() { @Override public void onResponse(Call> call, diff --git a/app/src/main/java/com/utopiaindustries/qualitychecker/ui/fragments/ThirdStepFragment.java b/app/src/main/java/com/utopiaindustries/qualitychecker/ui/fragments/ThirdStepFragment.java index 4290b59..a0f6483 100644 --- a/app/src/main/java/com/utopiaindustries/qualitychecker/ui/fragments/ThirdStepFragment.java +++ b/app/src/main/java/com/utopiaindustries/qualitychecker/ui/fragments/ThirdStepFragment.java @@ -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 adapter = new ArrayAdapter<>( getContext(), + ArrayAdapter 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(){ diff --git a/app/src/main/res/layout/fragment_first_step.xml b/app/src/main/res/layout/fragment_first_step.xml index d2f35af..5c7b8d8 100644 --- a/app/src/main/res/layout/fragment_first_step.xml +++ b/app/src/main/res/layout/fragment_first_step.xml @@ -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"> @@ -604,7 +610,12 @@ diff --git a/app/src/main/res/layout/fragment_third_step.xml b/app/src/main/res/layout/fragment_third_step.xml index c84c247..74ca7b9 100644 --- a/app/src/main/res/layout/fragment_third_step.xml +++ b/app/src/main/res/layout/fragment_third_step.xml @@ -335,20 +335,20 @@ android:orientation="horizontal" android:padding="10dp"> - - + --> + android:layout_weight="0.8" + android:prompt="@string/spinner_title" /> - + android:orientation="vertical" + android:layout_weight="0.6"> - + + + + + + android:orientation="vertical" + android:layout_weight="0.4"> + + + + + + +