removed status on purchase order android
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package com.example.petstoremobile.adapters;
|
package com.example.petstoremobile.adapters;
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -49,27 +48,6 @@ public class PurchaseOrderAdapter extends RecyclerView.Adapter<PurchaseOrderAdap
|
|||||||
binding.tvPOStore.setText("Store: " + (po.getStoreName() != null ? po.getStoreName() : ""));
|
binding.tvPOStore.setText("Store: " + (po.getStoreName() != null ? po.getStoreName() : ""));
|
||||||
binding.tvPODate.setText("Date: " + (po.getOrderDate() != null ? po.getOrderDate() : ""));
|
binding.tvPODate.setText("Date: " + (po.getOrderDate() != null ? po.getOrderDate() : ""));
|
||||||
|
|
||||||
String status = po.getStatus() != null ? po.getStatus() : "";
|
|
||||||
binding.tvPOStatus.setText(status);
|
|
||||||
|
|
||||||
switch (status.toUpperCase()) {
|
|
||||||
case "RECEIVED":
|
|
||||||
binding.tvPOStatus.setBackgroundColor(Color.parseColor("#4CAF50"));
|
|
||||||
break;
|
|
||||||
case "PLACED":
|
|
||||||
binding.tvPOStatus.setBackgroundColor(Color.parseColor("#2196F3"));
|
|
||||||
break;
|
|
||||||
case "PENDING":
|
|
||||||
binding.tvPOStatus.setBackgroundColor(Color.parseColor("#FF9800"));
|
|
||||||
break;
|
|
||||||
case "CANCELLED":
|
|
||||||
binding.tvPOStatus.setBackgroundColor(Color.parseColor("#F44336"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
binding.tvPOStatus.setBackgroundColor(Color.parseColor("#9E9E9E"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.itemView.setOnClickListener(v -> listener.onPurchaseOrderClick(position));
|
holder.itemView.setOnClickListener(v -> listener.onPurchaseOrderClick(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.example.petstoremobile.fragments.listfragments.detailfragments;
|
package com.example.petstoremobile.fragments.listfragments.detailfragments;
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -82,26 +81,6 @@ public class PurchaseOrderDetailFragment extends Fragment {
|
|||||||
binding.tvPODetailSupplier.setText(po.getSupplierName());
|
binding.tvPODetailSupplier.setText(po.getSupplierName());
|
||||||
binding.tvPODetailStore.setText(po.getStoreName() != null ? po.getStoreName() : "N/A");
|
binding.tvPODetailStore.setText(po.getStoreName() != null ? po.getStoreName() : "N/A");
|
||||||
binding.tvPODetailDate.setText(po.getOrderDate());
|
binding.tvPODetailDate.setText(po.getOrderDate());
|
||||||
|
|
||||||
String status = po.getStatus() != null ? po.getStatus() : "";
|
|
||||||
binding.tvPODetailStatus.setText(status);
|
|
||||||
switch (status.toUpperCase()) {
|
|
||||||
case "RECEIVED":
|
|
||||||
binding.tvPODetailStatus.setTextColor(Color.parseColor("#4CAF50"));
|
|
||||||
break;
|
|
||||||
case "PLACED":
|
|
||||||
binding.tvPODetailStatus.setTextColor(Color.parseColor("#2196F3"));
|
|
||||||
break;
|
|
||||||
case "PENDING":
|
|
||||||
binding.tvPODetailStatus.setTextColor(Color.parseColor("#FF9800"));
|
|
||||||
break;
|
|
||||||
case "CANCELLED":
|
|
||||||
binding.tvPODetailStatus.setTextColor(Color.parseColor("#F44336"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
binding.tvPODetailStatus.setTextColor(Color.parseColor("#9E9E9E"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (resource.status == Resource.Status.ERROR) {
|
} else if (resource.status == Resource.Status.ERROR) {
|
||||||
Toast.makeText(getContext(), "Failed to load order: " + resource.message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "Failed to load order: " + resource.message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,19 +105,6 @@
|
|||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:layout_marginBottom="16dp"/>
|
android:layout_marginBottom="16dp"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Status"
|
|
||||||
android:textColor="@color/text_light"
|
|
||||||
android:textSize="12sp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvPODetailStatus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:layout_marginBottom="16dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -27,19 +27,6 @@
|
|||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvPOStatus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingTop="3dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
android:paddingBottom="3dp"
|
|
||||||
android:text="Status"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="11sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Reference in New Issue
Block a user