diff --git a/src/components/CustomToast.js b/src/components/CustomToast.js deleted file mode 100644 index 5e58a67..0000000 --- a/src/components/CustomToast.js +++ /dev/null @@ -1,24 +0,0 @@ -import React from "react"; -import { Alert, CloseIcon, HStack, IconButton, Text, Toast, ToastDescription, ToastTitle, useToast, VStack } from "@gluestack-ui/themed"; - -const CustomToast = ({ - id, - status, - variant, - title, - description, - isClosable, - ...rest -}) => { - const toast = useToast(); - return ( - - - { title ? {title} : null } - { description ? {description} : null } - - - ) -} - -export default CustomToast; \ No newline at end of file diff --git a/src/components/HorizontalLine.js b/src/components/HorizontalLine.js deleted file mode 100644 index 9f6cfbc..0000000 --- a/src/components/HorizontalLine.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react"; -import { View } from "react-native"; - -const HorizontalLine = ({width, borderStyle}) => { - return -} - -export default HorizontalLine; \ No newline at end of file diff --git a/src/components/NoData.js b/src/components/NoData.js deleted file mode 100644 index 176584b..0000000 --- a/src/components/NoData.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from "react" -import { Box, Text } from "@gluestack-ui/themed" -import { strings } from "../utils/i18n" - -export const NoDataContent = () => { - return ( - - {strings('global.noData')} - - ) -} \ No newline at end of file diff --git a/src/components/Shipment.js b/src/components/Shipment.js deleted file mode 100644 index 5a47c13..0000000 --- a/src/components/Shipment.js +++ /dev/null @@ -1,144 +0,0 @@ -import { Box, HStack, Heading, Text } from '@gluestack-ui/themed' -import { VStack } from '@gluestack-ui/themed' -import React from 'react' -import { strings } from '../utils/i18n' -import VerticalLine from './VerticalLine' -import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; -import { colorStatusDecider, dropPointLocationRenderer } from '../utils/general' -import { Image, ScrollView } from 'react-native' -import { TouchableOpacity } from 'react-native-gesture-handler' -import { store } from '../appredux/store' -import { setSelectedHistoryPicture, setSelectedHistoryPictures, setShowHistoryPicture } from '../appredux/actions' - -export const RenderDeliveryOrder = ({data}) => { - if (data && data.length > 0) { - return data.map((item, idx) => { - return ( - - - {strings('label.dropPointLocations')} - - - - - ) - }) - } -} - -export const PointConnector = () => { - return ( - - - - - - - ) -} - -export const RenderDropPoint = ({data}) => { - if (data && data.length > 0) { - return data.map((item, idx) => { - return ( - - - - - - - - {dropPointLocationRenderer(item, 'name')} - - - {dropPointLocationRenderer(item, 'address')} - - - {item.status === 'completed' || item.status === 'cancel' ? - - : null - } - - {item.status === 'completed' || item.status === 'cancel' ? - - : null - } - - {item.status === 'completed' || item.status === 'cancel' ? - - {strings('global.notes')}: - {item.driver_notes && item.driver_notes !== '' ? item.driver_notes : '-'} - - : null - } - - - - { idx !== data.length - 1 ? : null} - - ) - }) - } -} - -export const RenderDropPointPictures = ({data}) => { - return ( - - - {strings('history.dropPointPictures')} - - - { data && data.length > 0 ? data.map((item, idx) => ( - { - store.dispatch(setSelectedHistoryPicture(item)) - store.dispatch(setShowHistoryPicture(true)) - }}> - - - - - )) : - } - - - ) -} - -export const RenderDropPointSignature = ({data}) => { - return ( - - - {strings('history.signaturePicture')} - - - { data && data.length > 0 ? data.map((item, idx) => ( - { - store.dispatch(setSelectedHistoryPicture(item)) - store.dispatch(setShowHistoryPicture(true)) - }}> - - - - - )) : - } - - - ) -} \ No newline at end of file diff --git a/src/components/VerticalLine.js b/src/components/VerticalLine.js deleted file mode 100644 index d4ae764..0000000 --- a/src/components/VerticalLine.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from "react"; -import { View } from "react-native"; - -const VerticalLine = ({height}) => { - return -} - -export default VerticalLine; \ No newline at end of file diff --git a/src/services/sqlite/ospod_photo.js b/src/services/sqlite/ospod_photo.js deleted file mode 100644 index 1d74a98..0000000 --- a/src/services/sqlite/ospod_photo.js +++ /dev/null @@ -1,20 +0,0 @@ - -import { deleteRow, dropTable, insertTable, selectRow } from './index'; - -const TABLE_NAME = 'ospod_photo'; - -export const storePhoto = (user_id, drop_point_id, image_uri, image_blob, lat, lon) => { - insertTable(TABLE_NAME, [user_id, drop_point_id, image_uri, image_blob, lat, lon]) -} - -export const deletePhoto = (row_id, callback) => { - deleteRow(TABLE_NAME, row_id, (deleted) => callback(deleted)) -} - -export const selectAllPhoto = (callback) => { - selectRow(TABLE_NAME, null, (data) => callback(data)) -} - -export const dropTablePhoto = (callback) => { - dropTable(TABLE_NAME, (dropped) => callback(dropped)) -} \ No newline at end of file diff --git a/src/utils/Toast.js b/src/utils/Toast.js deleted file mode 100644 index 9655589..0000000 --- a/src/utils/Toast.js +++ /dev/null @@ -1,52 +0,0 @@ -import React from "react"; -import CustomToast from "../components/CustomToast"; -import { createContext, useContext, useRef } from "react"; -import Toast, { BaseToast, ErrorToast } from "react-native-toast-message"; -import { View, Text } from 'react-native' - -const renderTypeToast = (type) => { - let bgColor = 'muted.600' - if (type) { - if (type === 'success') { - bgColor = 'green.600'; - } - else if (type === 'error') { - bgColor = 'red.600'; - } - else if (type === 'warning') { - bgColor = 'yellow.600'; - } - } - return bgColor; -} - -export const toastr = { - show: (message, type, duration = 5000) => { - return ( - - ) - }, -}; - - - -export const toastConfig = { - success: ({ text1, props }) => ( - - {text1} - - ), - - error: ({ text1, props }) => ( - - {text1} - - ) -}; \ No newline at end of file diff --git a/src/utils/general.js b/src/utils/general.js deleted file mode 100644 index fa69b4e..0000000 --- a/src/utils/general.js +++ /dev/null @@ -1,37 +0,0 @@ -import { color_cancel, color_complete, color_on_progress, color_open } from "../config/Styles"; - -export const EMPTY_DATE = ["1900-01-01 00:00:00", null, ""]; -export const DATE_FORMAT = "D MMMM YYYY HH:mm"; - -export const dropPointLocationRenderer = (data, key) => { - let spatial_type = data.spatial_type; - let output = '-'; - let key_ = 'transitpoint_'+key; - if (spatial_type === 'pool') { - key_ = 'pool_'+key; - output = data?.join?.[key_]; - } - else if (spatial_type === 'transit_point') { - key_ = 'transitpoint_'+key; - output = data?.join?.[key_]; - } - else if (spatial_type === 'geofence') { - key_ = 'geofence_'+key; - output = data?.join?.[key_]; - } - - // validate to put - - if (output == "") { - output = "-" - } - - return output; -} - -export const colorStatusDecider = (item) => { - if (!item) { - return null; - } - // return item.status === "open" || EMPTY_DATE.includes(item.in_time) ? color_open : item.status === "on-progress" ? color_on_progress : color_complete - return item.status === "open" ? color_open : item.status === "on-progress" ? color_on_progress : item.status === "completed" ? color_complete : color_cancel; -} \ No newline at end of file diff --git a/src/utils/shipment.js b/src/utils/shipment.js deleted file mode 100644 index 4665467..0000000 --- a/src/utils/shipment.js +++ /dev/null @@ -1,38 +0,0 @@ -import { setSelectedDropPoint, setShipmentData } from "../appredux/actions"; -import { store } from "../appredux/store"; -import ApiShipment from "../services/api/shipment"; - - -export const getShipmentData = async () => { - const shipment = await ApiShipment.searchDetail('open,on-progress'); - if (shipment && shipment.status === true && shipment.data) { - if (shipment.data.length > 0) { - return shipment.data[0]; - } - else { - return null; - } - } - else { - return null; - } -} - - -// this function is to update shipmentData and selectedDropPoint state in redux based on current selectedDropPoint -// flow -> get API then update redux state -export const updateShipmentState = (dp_item, callback) => { - let promiseSave = new Promise((resolve, reject) => { - let shipment = getShipmentData(); - resolve(shipment); - }) - promiseSave.then(val => { - let doIdx = val.delivery_order.findIndex(x => parseInt(x.id) === parseInt(dp_item.delivery_order)); - let dpIdx = val.delivery_order[doIdx].drop_point.findIndex(x => parseInt(x.id) === parseInt(dp_item.id)); - let updatedDp = val.delivery_order[doIdx].drop_point[dpIdx]; - store.dispatch(setShipmentData(val)); - store.dispatch(setSelectedDropPoint(null)); - store.dispatch(setSelectedDropPoint(updatedDp)) - callback(updatedDp) - }) -} \ No newline at end of file