Skip to content

Commit

Permalink
addon duplication frontend code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatima authored and Fatima committed Dec 5, 2024
1 parent 092b2d8 commit a135672
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions enatega-multivendor-admin/src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions enatega-multivendor-app/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
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
8 changes: 4 additions & 4 deletions enatega-multivendor-restaurant/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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://[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,6 +42,9 @@ export default function OrderDetails({ orderData }) {
)
}
function OrderItems({ orderData }) {

// console.log("orderData=>>", JSON.stringify(orderData, null, 2));

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

0 comments on commit a135672

Please sign in to comment.