Skip to content

Commit

Permalink
Merge pull request #677 from enatega/fatima_addondup
Browse files Browse the repository at this point in the history
addon duplication frontend code,missing id issue
  • Loading branch information
ufumerfarooq67 authored Dec 5, 2024
2 parents 02b3a0e + 334525f commit 5676947
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions enatega-multivendor-app/src/apollo/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const placeOrder = `
placeOrder(restaurant:$restaurant,orderInput: $orderInput,paymentMethod:$paymentMethod,couponCode:$couponCode,tipping:$tipping, taxationAmount: $taxationAmount, address:$address, orderDate: $orderDate,isPickedUp: $isPickedUp, deliveryCharges:$deliveryCharges, instructions: $instructions) {
_id
orderId
id
restaurant{
_id
name
Expand All @@ -34,20 +35,24 @@ export const placeOrder = `
}
items{
_id
id
title
food
description
quantity
variation{
_id
id
title
price
discounted
}
addons{
_id
id
options{
_id
id
title
description
price
Expand Down
8 changes: 6 additions & 2 deletions enatega-multivendor-app/src/screens/Checkout/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function Checkout(props) {
const { loading: loadingTip, data: dataTip } = useQuery(TIPPING, {
fetchPolicy: 'network-only'
})

const [mutateOrder] = useMutation(PLACEORDER, {
onCompleted,
onError,
Expand Down Expand Up @@ -348,6 +348,7 @@ function Checkout(props) {
function update(cache, { data: { placeOrder } }) {
try {
if (placeOrder && placeOrder.paymentMethod === 'COD') {
// console.log(JSON.stringify(placeOrder, null, 2))
cache.modify({
fields: {
orders(existingOrders = []) {
Expand Down Expand Up @@ -400,6 +401,7 @@ function Checkout(props) {
currency: configuration.currency
})
} else if (paymentMode === 'STRIPE') {
console.log("stripe")
props.navigation.replace('StripeCheckout', {
_id: data.placeOrder.orderId,
amount: data.placeOrder.orderAmount,
Expand All @@ -421,6 +423,7 @@ function Checkout(props) {
message: error.message
})
}
console.log('Order placed successfully:', data);
}

function calculateTip() {
Expand All @@ -439,8 +442,9 @@ function Checkout(props) {
} else {
return 0
}

}

function taxCalculation() {
const tax = data.restaurant ? +data.restaurant.tax : 0
if (tax === 0) {
Expand Down
4 changes: 2 additions & 2 deletions enatega-multivendor-restaurant/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const getEnvVars = (env = Updates.releaseChannel) => {
return {
// GRAPHQL_URL: 'http://192.168.0.109:8001/graphql',
// WS_GRAPHQL_URL: 'ws://192.168.0.109:8001/graphql',
GRAPHQL_URL: 'https://enatega-multivendor.up.railway.app/graphql',
WS_GRAPHQL_URL: 'wss://enatega-multivendor.up.railway.app/graphql',
GRAPHQL_URL: 'https://enatega-multivendor.up.railway.app/graphql',
WS_GRAPHQL_URL: 'wss://enatega-multivendor.up.railway.app/graphql',
SENTRY_DSN: configuration.restaurantAppSentryUrl
// SENTRY_DSN:
// 'https://[email protected]/6131933'
Expand Down
1 change: 1 addition & 0 deletions enatega-multivendor-restaurant/src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const orders = `query Orders{
deliveryAddress
details
label
id
}
items{
_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function OrderDetails({ orderData }) {
)
}
function OrderItems({ orderData }) {
// // console.log("OrderData",orderData)

const { t } = useTranslation()
const {
instructions,
Expand Down

0 comments on commit 5676947

Please sign in to comment.