From a1356724245515c26e763c514d7acda33309e450 Mon Sep 17 00:00:00 2001 From: Fatima Date: Thu, 5 Dec 2024 17:37:14 +0500 Subject: [PATCH] addon duplication frontend code --- enatega-multivendor-admin/src/config/constants.js | 4 ++-- enatega-multivendor-app/environment.js | 6 +++--- enatega-multivendor-app/src/apollo/mutations.js | 5 +++++ enatega-multivendor-app/src/screens/Checkout/Checkout.js | 8 ++++++-- enatega-multivendor-restaurant/environment.js | 8 ++++---- enatega-multivendor-restaurant/src/apollo/queries.js | 1 + .../src/components/OrderDetails/OrderDetails.js | 3 +++ 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/enatega-multivendor-admin/src/config/constants.js b/enatega-multivendor-admin/src/config/constants.js index 81354511..e8197b23 100644 --- a/enatega-multivendor-admin/src/config/constants.js +++ b/enatega-multivendor-admin/src/config/constants.js @@ -6,8 +6,8 @@ const ConfigurableValues = () => { const SERVER_URL = 'https://enatega-multivendor.up.railway.app' const WS_SERVER_URL = 'wss://enatega-multivendor.up.railway.app' - // const SERVER_URL = 'http://192.168.0.106:8001' - // const WS_SERVER_URL = 'ws://192.168.0.106:8001' + // const SERVER_URL = 'http://192.168.0.109:8001' + // const WS_SERVER_URL = 'ws://192.168.0.109:8001' const GOOGLE_MAPS_KEY = configuration.googleApiKey const FIREBASE_KEY = configuration.firebaseKey const APP_ID = configuration.appId diff --git a/enatega-multivendor-app/environment.js b/enatega-multivendor-app/environment.js index cc85bab4..56ec3658 100644 --- a/enatega-multivendor-app/environment.js +++ b/enatega-multivendor-app/environment.js @@ -32,9 +32,9 @@ const useEnvVars = (env = Updates.channel) => { GRAPHQL_URL: 'https://enatega-multivendor.up.railway.app/graphql', WS_GRAPHQL_URL: 'wss://enatega-multivendor.up.railway.app/graphql', SERVER_URL: 'https://enatega-multivendor.up.railway.app/', - // GRAPHQL_URL: 'http://192.168.0.106:8001/graphql', - // WS_GRAPHQL_URL: 'ws://192.168.0.106:8001/graphql', - // SERVER_URL: 'http://192.168.0.106:8001:8001/', + // GRAPHQL_URL: 'http://192.168.0.109:8001/graphql', + // WS_GRAPHQL_URL: 'ws://192.168.0.109:8001/graphql', + // SERVER_URL: 'http://192.168.0.109:8001:8001/', IOS_CLIENT_ID_GOOGLE: configuration.iOSClientID, ANDROID_CLIENT_ID_GOOGLE: configuration.androidClientID, AMPLITUDE_API_KEY: configuration.appAmplitudeApiKey, diff --git a/enatega-multivendor-app/src/apollo/mutations.js b/enatega-multivendor-app/src/apollo/mutations.js index a1366060..edaf6483 100644 --- a/enatega-multivendor-app/src/apollo/mutations.js +++ b/enatega-multivendor-app/src/apollo/mutations.js @@ -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 @@ -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 diff --git a/enatega-multivendor-app/src/screens/Checkout/Checkout.js b/enatega-multivendor-app/src/screens/Checkout/Checkout.js index 49475d32..6fec8040 100644 --- a/enatega-multivendor-app/src/screens/Checkout/Checkout.js +++ b/enatega-multivendor-app/src/screens/Checkout/Checkout.js @@ -168,7 +168,7 @@ function Checkout(props) { const { loading: loadingTip, data: dataTip } = useQuery(TIPPING, { fetchPolicy: 'network-only' }) - + const [mutateOrder] = useMutation(PLACEORDER, { onCompleted, onError, @@ -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 = []) { @@ -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, @@ -421,6 +423,7 @@ function Checkout(props) { message: error.message }) } + console.log('Order placed successfully:', data); } function calculateTip() { @@ -439,8 +442,9 @@ function Checkout(props) { } else { return 0 } + } - + function taxCalculation() { const tax = data.restaurant ? +data.restaurant.tax : 0 if (tax === 0) { diff --git a/enatega-multivendor-restaurant/environment.js b/enatega-multivendor-restaurant/environment.js index 2c83d1cd..492d1b11 100644 --- a/enatega-multivendor-restaurant/environment.js +++ b/enatega-multivendor-restaurant/environment.js @@ -20,10 +20,10 @@ const getEnvVars = (env = Updates.releaseChannel) => { } } return { - // GRAPHQL_URL: 'http://192.168.0.106:8001/graphql', - // WS_GRAPHQL_URL: 'ws://192.168.0.106:8001/graphql', - GRAPHQL_URL: 'https://enatega-multivendor.up.railway.app/graphql', - WS_GRAPHQL_URL: 'wss://enatega-multivendor.up.railway.app/graphql', + // 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', SENTRY_DSN: configuration.restaurantAppSentryUrl // SENTRY_DSN: // 'https://91b55f514a2c4708845789d6e79abf10@o1103026.ingest.sentry.io/6131933' diff --git a/enatega-multivendor-restaurant/src/apollo/queries.js b/enatega-multivendor-restaurant/src/apollo/queries.js index f3833a94..1059818c 100644 --- a/enatega-multivendor-restaurant/src/apollo/queries.js +++ b/enatega-multivendor-restaurant/src/apollo/queries.js @@ -15,6 +15,7 @@ export const orders = `query Orders{ deliveryAddress details label + id } items{ _id diff --git a/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js b/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js index d521a05d..79db279b 100644 --- a/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js +++ b/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js @@ -42,6 +42,9 @@ export default function OrderDetails({ orderData }) { ) } function OrderItems({ orderData }) { + + // console.log("orderData=>>", JSON.stringify(orderData, null, 2)); + const { t } = useTranslation() const { items,