Skip to content

Commit

Permalink
Merge pull request #717 from enatega/fix/RatingFilterNotWorking
Browse files Browse the repository at this point in the history
Fix/rating filter not working
  • Loading branch information
ufumerfarooq67 authored Dec 20, 2024
2 parents c8928ba + 6e00280 commit c287204
Show file tree
Hide file tree
Showing 18 changed files with 134 additions and 51 deletions.
2 changes: 2 additions & 0 deletions enatega-multivendor-app/src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ export const FavouriteRestaurant = `query UserFavourite ($latitude:Float,$longit
orderId
orderPrefix
name
reviewCount
reviewAverage
image
address
location{coordinates}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@ const ActiveOrders = ({ onActiveOrdersChange }) => {
const navigation = useNavigation()
const themeContext = useContext(ThemeContext)
const currentTheme = theme[themeContext.ThemeValue]
const activeOrders = orders.filter(o =>
const activeOrders = orders.filter((o) =>
orderStatusActive.includes(o.orderStatus)
)
const onPressDetails = order => {

const onPressDetails = (order) => {
navigation.navigate('OrderDetail', {
_id: order._id,
currencySymbol: configuration.currencySymbol
})
}

const navToActiveOrders = () => {
navigation.navigate('MyOrders')
}

const [showAll, setShowAll] = useState(false)

const displayOrders = showAll ? activeOrders : activeOrders.slice(0, 2)
Expand All @@ -53,18 +58,27 @@ const ActiveOrders = ({ onActiveOrdersChange }) => {
const order = displayOrders[0]
const remainingTime = calulateRemainingTime(order)
const modalStyle = {
borderWidth: StyleSheet.hairlineWidth,
backgroundColor: currentTheme.themeBackground,

};
borderWidth: StyleSheet.hairlineWidth,
backgroundColor: currentTheme.themeBackground
}

return (
<Modalize alwaysOpen={MODAL_HEIGHT} withHandle={false} modalHeight={MODAL_HEIGHT} modalStyle={modalStyle}>
<Modalize
alwaysOpen={MODAL_HEIGHT}
withHandle={false}
modalHeight={MODAL_HEIGHT}
modalStyle={modalStyle}
>
<View style={{ marginTop: scale(20), marginHorizontal: scale(10) }}>
<View style={{ justifyContent: 'space-between', flexDirection: 'row' }}>
<TextDefault Regular textColor={currentTheme.fontGrayNew}>{t('estimatedDeliveryTime')}</TextDefault>
<TextDefault Regular textColor={currentTheme.fontGrayNew}>
{t('estimatedDeliveryTime')}
</TextDefault>

<TouchableOpacity onPress={() => onPressDetails(order)}>
<TextDefault textColor={currentTheme.gray700} bolder>{t('details')}</TextDefault>
<TextDefault textColor={currentTheme.gray700} bolder>
{t('details')}{' '}
</TextDefault>
</TouchableOpacity>
</View>
<View style={{ marginTop: scale(10) }}>
Expand All @@ -82,14 +96,44 @@ const ActiveOrders = ({ onActiveOrdersChange }) => {
<View style={{ marginTop: scale(10) }}>
<TextDefault
numberOfLines={2}
style={styles(currentTheme).statusText}>
style={styles(currentTheme).statusText}
>
{t(checkStatus(order.orderStatus).statusText)}
</TextDefault>
</View>

<View
style={{
justifyContent: 'flex-start',
flexDirection: 'row',
paddingRight: 20,
marginBottom: 10
}}
>
{ activeOrders.length > 1 ?
(<View style={{}}>
<TouchableOpacity onPress={() => navToActiveOrders()}>
<TextDefault bolder H5 Regular textColor={currentTheme.gray700}>
{t('ActiveOrders')}
</TextDefault>
</TouchableOpacity>
<View style={styles(currentTheme.primary).absoluteContainer}>
<TextDefault
textColor={currentTheme.black}
style={{ fontSize: scale(12) }}
center
bolder
>
{activeOrders.length}
</TextDefault>
</View>
</View>
) : ''
}
</View>
</View>
</View>
</Modalize>

)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,20 @@ const styles = (props = null) =>
marginTop: scale(2),
marginBottom: scale(2),
paddingLeft: scale(40)
}
},
absoluteContainer: {
width: verticalScale(20),
height: verticalScale(20),
backgroundColor: '#90E36D',
justifyContent: 'center',
alignItems: 'center',
borderRadius: scale(15),
position: 'absolute',
padding:3,
right: scale(-25),
bottom: scale(2)
},

})

export default styles
2 changes: 1 addition & 1 deletion enatega-multivendor-app/src/components/Main/Item/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function Item(props) {
numberOfLines={1}
bold
Normal>
{configuration.currencySymbol + '' + item.minimumOrder}{' '}
{configuration.currencySymbol + ' ' + item.tax}{' '}
</TextDefault>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function NewRestaurantCard(props) {
numberOfLines={1}
bold
Normal>
${props.tax}
{configuration.currencySymbol + ' ' + props.tax}{' '}
</TextDefault>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ function ImageTextCenterHeader(props, ref) {
style={styles().restaurantAbout}
textColor={currentTheme.fontMainColor}
>
{configuration.currencySymbol}{' '}{aboutObject.restaurantTax} {t('deliveryCharges')}
{configuration.currencySymbol}{' '}{aboutObject.restaurantTax} {t('taxFee')}
</TextDefault>
</View>
<View
Expand Down
2 changes: 1 addition & 1 deletion enatega-multivendor-app/src/screens/Home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ function Main(props) {
style={{ ...alignment.PLlarge }}
textColor={currentTheme.fontSecondColor}
small>
{address.deliveryAddress}
{address.deliveryAddress}
</TextDefault>
</View>
</TouchableOpacity>
Expand Down
5 changes: 4 additions & 1 deletion enatega-multivendor-app/src/screens/Menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function Menu({ route, props }) {
ip: null
},
onCompleted: data => {

setRestaurantData(data.nearByRestaurantsPreview.restaurants)
setSectionData(data.nearByRestaurantsPreview.sections)
},
Expand Down Expand Up @@ -413,10 +414,12 @@ function Menu({ route, props }) {
if (ratings?.selected?.length > 0) {
const numericRatings = ratings.selected?.map(extractRating)
filteredData = filteredData.filter(
item => item?.reviewData?.ratings >= Math.min(...numericRatings)
item => item?.reviewAverage >= Math.min(...numericRatings)
)
}



// Sort filter
if (sort?.selected?.length > 0) {
if (sort.selected[0] === 'Fast Delivery') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ function OrderDetail(props) {
const headerRef = useRef(false)
const { GOOGLE_MAPS_KEY } = useEnvVars()
const mapView = useRef(null)

const [cancelOrder, { loading: loadingCancel }] = useMutation(CANCEL_ORDER, {
onError,
onCompleted:(data)=>
{
if(data.abortOrder.orderStatus === 'CANCELLED')
{
navigation.navigate("Main")
}
},
variables: { abortOrderId: id }
})

Expand All @@ -77,6 +85,7 @@ function OrderDetail(props) {
setCancelModalVisible(!cancelModalVisible)
}
function onError(error) {

FlashMessage({
message: error.message
})
Expand Down
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/ar.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,5 +542,6 @@ export const ar = {
pickupTime: 'وقت الاستلام',
asap: 'فورًا',
selectOptionforAddon: 'يرجى اختيار خيار للوظيفة الإضافية',
whatsAppText: 'تحتاج مساعدة أكثر؟ اتصل بنا'
whatsAppText: 'تحتاج مساعدة أكثر؟ اتصل بنا',
ActiveOrders:"الطلبات النشطة",
}
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,5 +559,6 @@ export const de = {
pickupTime: 'Ophaaltijd',
asap: 'Zo snel mogelijk',
selectOptionforAddon: 'Bitte wählen Sie eine Option für das Add-On aus',
whatsAppText: 'Benötigen Sie weitere Hilfe? Kontaktieren Sie uns'
whatsAppText: 'Benötigen Sie weitere Hilfe? Kontaktieren Sie uns',
ActiveOrders:"Aktive Bestellungen",
}
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,5 +552,6 @@ export const en = {
salesTax: 'Sales Tax',
minimumOrder: 'Minimum Order',
selectOptionforAddon: 'Please select an option for addon',
whatsAppText: 'Need more help? Contact us'
whatsAppText: 'Need more help? Contact us',
ActiveOrders:"Active Orders",
}
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,5 +556,6 @@ export const fr = {
pickupTime: 'Heure de ramassage',
asap: 'Dès que possible',
selectOptionforAddon: "Veuillez sélectionner une option pour l'addon",
whatsAppText: "Besoin de plus d'aide? Contactez-nous"
whatsAppText: "Besoin de plus d'aide? Contactez-nous",
ActiveOrders:"Commandes actives",
}
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/he.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,6 @@ export const he = {
pickupTime: 'זמן איסוף',
asap: 'בהקדם האפשרי',
selectOptionforAddon: 'בבקשה בחר אפשרות עבור התוסף',
whatsAppText: 'צריך עזרה נוספת? צור קשר'
whatsAppText: 'צריך עזרה נוספת? צור קשר',
ActiveOrders:"הזמנות פעילות",
}
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/km.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,5 +540,6 @@ export const km = {
pickupTime: 'ពេលវេលា​យកឡើង',
asap: 'ដោយសារយោង',
selectOptionforAddon: 'សូមជ្រើសរើស​ជម្រើសសម្រាប់​គ្រឿង​បន្ថែម',
whatsAppText: 'ត្រូវការជំនួយច្រើនទៀត? ទាក់ទង​មកយើង'
whatsAppText: 'ត្រូវការជំនួយច្រើនទៀត? ទាក់ទង​មកយើង',
ActiveOrders:"បញ្ជាទិញសកម្ម",
}
3 changes: 2 additions & 1 deletion enatega-multivendor-app/translations/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,5 +526,6 @@ export const zh = {
pickupTime: '取货时间',
asap: '尽快',
selectOptionforAddon: '请为附加组件选择一个选项',
whatsAppText: '需要更多帮助?联系我们'
whatsAppText: '需要更多帮助?联系我们',
ActiveOrders: "活动订单",
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { Ionicons, Entypo } from '@expo/vector-icons'
import TextDefault from '../../components/Text/TextDefault/TextDefault'
import styles from './styles'
import colors from '../../utilities/colors'
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context'

import {useTranslation} from 'react-i18next'
import { useTranslation } from 'react-i18next'

const ChatScreen = ({ navigation, route }) => {
const {
Expand All @@ -21,7 +22,7 @@ const ChatScreen = ({ navigation, route }) => {
profile
} = useChatScreen({ navigation, route })

const {t} = useTranslation()
const { t } = useTranslation()
const filterImages = src => {
setImage(image.filter(item => item !== src))
}
Expand Down Expand Up @@ -101,29 +102,33 @@ const ChatScreen = ({ navigation, route }) => {
}

return (
<GiftedChat
messages={messages}
user={{
_id: profile.rider._id
}}
renderBubble={renderBubble}
renderSend={renderSend}
scrollToBottom
scrollToBottomComponent={scrollToBottomComponent}
renderAvatar={null}
renderUsernameOnMessage
renderChatEmpty={renderChatEmpty}
inverted={Platform.OS !== 'web' || messages.length === 0}
timeTextStyle={{
left: { color: colors.fontMainColor },
right: { color: colors.horizontalLine }
}}
placeholder={t('message')}
textInputStyle={{ paddingTop: 10 }}
renderAccessory={image.length > 0 ? renderAccessory : null}
text={inputMessage}
onInputTextChanged={m => setInputMessage(m)}
/>
<SafeAreaProvider>
<SafeAreaView style={{ flex: 1 }}>
<GiftedChat
messages={messages}
user={{
_id: profile.rider._id
}}
renderBubble={renderBubble}
renderSend={renderSend}
scrollToBottom
scrollToBottomComponent={scrollToBottomComponent}
renderAvatar={null}
renderUsernameOnMessage
renderChatEmpty={renderChatEmpty}
inverted={Platform.OS !== 'web' || messages.length === 0}
timeTextStyle={{
left: { color: colors.fontMainColor },
right: { color: colors.horizontalLine }
}}
placeholder={t('message')}
textInputStyle={{ paddingTop: 10 }}
renderAccessory={image.length > 0 ? renderAccessory : null}
text={inputMessage}
onInputTextChanged={m => setInputMessage(m)}
/>
</SafeAreaView>
</SafeAreaProvider>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default StyleSheet.create({
sendIcon: { marginBottom: 7, marginRight: 10 },
emptyChat: {
marginTop: 300,
transform: [{ scaleY: -1 }, {scaleX: -1}],
alignSelf:'center'
transform: [{ scaleY: -1 }],
alignSelf: 'center'
},
bubbleRight: {
backgroundColor: colors.black,
Expand Down

0 comments on commit c287204

Please sign in to comment.