reza fixed strings on Cart

master
Reza_ashrafi 2 years ago
parent ed0b11f49b
commit 7aed7b068d
  1. 43
      src/screens/ShoppingCart/components/Product.js
  2. 6
      src/screens/ShoppingCart/index.js

@ -51,9 +51,7 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
]}
/>
<View
style={tw(
`flex ${ios ? "items-start pl-3" : "items-end pr-2"}`
)}
style={tw(`flex ${ios ? "items-start pl-3" : "items-end pr-2"}`)}
>
<Text
style={{
@ -63,7 +61,7 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
fontFamily: "bold",
}}
>
{product.product.book.name}
{product?.product?.book?.name || " "}
</Text>
<Text
style={{
@ -73,7 +71,7 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
fontFamily: "regular",
}}
>
{"پایه" + " " + grades[product.product.book.gradeId]}
{"پایه" + " " + grades[product?.product?.book?.gradeId] || " "}
</Text>
<Text
style={{
@ -82,7 +80,7 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
fontFamily: "regular",
}}
>
{product.productType === 2 ? "نسخه فیزیکی" : "نسخه دیجیتال"}
{product?.productType || 1 === 2 ? "نسخه فیزیکی" : "نسخه دیجیتال"}
</Text>
<View
style={tw(
@ -109,15 +107,13 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
},
]}
>
{separate(product?.product?.price)}
{separate(product?.product?.price) || ' '}
</Text>
</View>
</View>
</View>
<View
style={tw(
`flex justify-between ${ios ? "items-end" : "items-start"}`
)}
style={tw(`flex justify-between ${ios ? "items-end" : "items-start"}`)}
>
<AntDesign
name="close"
@ -151,7 +147,9 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
}
style={[
tw(
`rounded-md py-0 flex flex-row justify-center items-center border ${mobile ? 'px-2' : "px-3"}`
`rounded-md py-0 flex flex-row justify-center items-center border ${
mobile ? "px-2" : "px-3"
}`
),
{
borderColor: Colors.theme1[colorScheme].greenCF,
@ -199,7 +197,9 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
}
style={[
tw(
`rounded-md py-0 flex flex-row justify-center items-center border ${mobile ? 'px-2.5' : 'px-3.5'}`
`rounded-md py-0 flex flex-row justify-center items-center border ${
mobile ? "px-2.5" : "px-3.5"
}`
),
{
borderColor: Colors.theme1[colorScheme].greenCF,
@ -217,12 +217,25 @@ function Product({ product, grades, pushToCart, loading, mobile }) {
</Text>
</Pressable>
</View>
<View style={tw(`flex items-center justify-center ${ios ? "flex-row-reverse" : "flex-row"}`)}>
<View
style={tw(
`flex items-center justify-center ${
ios ? "flex-row-reverse" : "flex-row"
}`
)}
>
<Text style={[{ fontSize: fontSize.sm, fontFamily: "regular" }]}>
{" " + "تومان"}
</Text>
<Text style={[{ fontSize: mobile ? fontSize.xl : fontSize.xl4, fontFamily: "regular" }]}>
{separate(product.product.price * product.count)}
<Text
style={[
{
fontSize: mobile ? fontSize.xl : fontSize.xl4,
fontFamily: "regular",
},
]}
>
{separate(product?.product?.price * product?.count) || ' '}
</Text>
</View>
</View>

@ -157,18 +157,18 @@ function ShoppingCart({
>
<PriceStatus
name="مبلغ سبد خرید"
value={isEmpty ? 0 : separate(Math.round(factorInfo?.sumPrice))}
value={isEmpty ? 0 : separate(Math.round(factorInfo?.sumPrice || 0))}
type="normal"
/>
<PriceStatus
name="میزان تخفیف"
value={isEmpty ? 0 : separate(Math.round(factorInfo?.offPrice))}
value={isEmpty ? 0 : separate(Math.round(factorInfo?.offPrice || 0))}
type="error"
/>
<PriceStatus
name="مالیات بر ارزش افزوده"
value={
isEmpty ? 0 : separate(Math.round(factorInfo?.sumPrice * 0.009))
isEmpty ? 0 : separate(Math.round((factorInfo?.sumPrice || 0) * 0.009))
}
type="error"
/>

Loading…
Cancel
Save