Viktoriia преди 4 дни
родител
ревизия
3d61b19b86

+ 1 - 0
src/modules/api/events/events-api.ts

@@ -14,6 +14,7 @@ export type SingleEvent = {
   id: number;
   active: 0 | 1;
   full: 0 | 1;
+  closed: 0 | 1;
   name: string;
   url: string;
   date: string;

+ 36 - 4
src/screens/InAppScreens/TravelsScreen/CreateSharedTrip/index.tsx

@@ -72,6 +72,7 @@ const CreateSharedTripScreen = ({ route }: { route: any }) => {
   const [photos, setPhotos] = useState<any[]>([]);
   const [regions, setRegions] = useState<any[]>(route.params?.regionsToSave ?? []);
   const [regionsError, setRegionsError] = useState<string | null>(null);
+  const [photosError, setPhotosError] = useState<string | null>(null);
 
   useEffect(() => {
     if (route.params?.regionsToSave) {
@@ -233,12 +234,17 @@ const CreateSharedTripScreen = ({ route }: { route: any }) => {
                     {
                       onSuccess: (res) => {
                         setIsSubmitting(false);
-                        console.log('res', res);
-                        navigation.goBack();
+                        setModalInfo({
+                          visible: true,
+                          type: 'success',
+                          title: 'Success',
+                          buttonTitle: 'OK',
+                          message: `Thank you for adding this new trip. It will undergo review soon. You'll be notified via email once it is approved.`,
+                          action: () => {}
+                        });
                       },
                       onError: (err) => {
                         setIsSubmitting(false);
-                        console.log('err', err);
                       }
                     }
                   );
@@ -396,6 +402,7 @@ const CreateSharedTripScreen = ({ route }: { route: any }) => {
                             photos,
                             selectPhoto: (photo: any) => {
                               props.setFieldValue('photo', photo);
+                              setPhotosError(null);
                             }
                           } as any
                         })
@@ -426,6 +433,19 @@ const CreateSharedTripScreen = ({ route }: { route: any }) => {
                     </View>
                   ) : null}
 
+                  {photosError ? (
+                    <Text
+                      style={{
+                        color: Colors.RED,
+                        fontSize: getFontSize(12),
+                        fontFamily: 'redhat-600',
+                        marginTop: -5
+                      }}
+                    >
+                      {photosError}
+                    </Text>
+                  ) : null}
+
                   <View>
                     <Text
                       style={{
@@ -532,10 +552,16 @@ const CreateSharedTripScreen = ({ route }: { route: any }) => {
                       <Button
                         onPress={() => {
                           if (regions.length === 0) {
-                            setRegionsError('Please add at least one region.');
+                            setRegionsError('please add at least one region');
                           } else {
                             setRegionsError(null);
                           }
+
+                          if (photos.length > 0 && !props.values.photo) {
+                            setPhotosError('please select a photo');
+                          } else {
+                            setPhotosError(null);
+                          }
                           props.handleSubmit();
                         }}
                         disabled={isSubmitting}
@@ -579,6 +605,12 @@ const CreateSharedTripScreen = ({ route }: { route: any }) => {
                           } else {
                             setRegionsError(null);
                           }
+
+                          if (photos.length > 0 && !props.values.photo) {
+                            setPhotosError('please select a photo');
+                          } else {
+                            setPhotosError(null);
+                          }
                           props.handleSubmit();
                         }}
                         disabled={isSubmitting}

+ 7 - 2
src/screens/InAppScreens/TravelsScreen/EventScreen/index.tsx

@@ -228,6 +228,11 @@ const EventScreen = ({ route }: { route: any }) => {
             color: Colors.LIGHT_GRAY,
             name: 'FULL'
           };
+        } else if (data.data.closed) {
+          return {
+            color: Colors.LIGHT_GRAY,
+            name: 'CLOSED'
+          };
         } else if (data.data.settings.type === 2) {
           return {
             color: Colors.ORANGE,
@@ -893,7 +898,7 @@ const EventScreen = ({ route }: { route: any }) => {
             <View
               style={{
                 position: 'absolute',
-                width: 71,
+                width: 'auto',
                 height: 31,
                 top: 170,
                 left: 0,
@@ -1607,7 +1612,7 @@ const EventScreen = ({ route }: { route: any }) => {
                   </TouchableOpacity>
                 )}
               </View>
-            ) : !event.full ? (
+            ) : !event.full && !event.closed ? (
               <TouchableOpacity
                 style={{
                   flexDirection: 'row',

+ 5 - 2
src/screens/InAppScreens/TravelsScreen/EventsScreen/index.tsx

@@ -303,6 +303,9 @@ const EventsScreen = () => {
     if (item.full) {
       badgeColor = Colors.LIGHT_GRAY;
       badgeText = 'FULL';
+    } else if (item.closed) {
+      badgeColor = Colors.LIGHT_GRAY;
+      badgeText = 'CLOSED';
     } else if (item.type === 2) {
       badgeColor = Colors.ORANGE;
       badgeText = 'TOUR';
@@ -322,7 +325,7 @@ const EventsScreen = () => {
         <TouchableOpacity
           style={[
             styles.card,
-            item.type === 2 || item.type === 3 || item.full
+            item.type === 2 || item.type === 3 || item.full || item.closed
               ? { backgroundColor: Colors.FILL_LIGHT }
               : { backgroundColor: Colors.WHITE }
           ]}
@@ -421,7 +424,7 @@ const EventsScreen = () => {
             )}
           </View>
 
-          {item.type === 2 || item.type === 3 || item.full ? (
+          {item.type === 2 || item.type === 3 || item.full || item.closed ? (
             <View
               style={[
                 styles.statusBadge,