digikhata-mashreq-sdk 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +37 -0
- package/lib/module/App.js +41 -0
- package/lib/module/App.js.map +1 -0
- package/lib/module/app/assets/Icons/Bill.png +0 -0
- package/lib/module/app/assets/Icons/Cash.png +0 -0
- package/lib/module/app/assets/Icons/Expense.png +0 -0
- package/lib/module/app/assets/Icons/Staff.png +0 -0
- package/lib/module/app/assets/Icons/Stock.png +0 -0
- package/lib/module/app/assets/images/bill.png +0 -0
- package/lib/module/app/assets/images/book.png +0 -0
- package/lib/module/app/assets/images/digiKhataSolo256.png +0 -0
- package/lib/module/app/assets/images/money.png +0 -0
- package/lib/module/app/assets/images/staff.png +0 -0
- package/lib/module/app/assets/images/stock.png +0 -0
- package/lib/module/app/assets/images/svgviewer-png-output-white.png +0 -0
- package/lib/module/app/components/Balance.js +153 -0
- package/lib/module/app/components/Balance.js.map +1 -0
- package/lib/module/app/components/CountryPhoneInput.js +271 -0
- package/lib/module/app/components/CountryPhoneInput.js.map +1 -0
- package/lib/module/app/components/Entries.js +89 -0
- package/lib/module/app/components/Entries.js.map +1 -0
- package/lib/module/app/components/SearchBar.js +70 -0
- package/lib/module/app/components/SearchBar.js.map +1 -0
- package/lib/module/app/components/Transaction.js +108 -0
- package/lib/module/app/components/Transaction.js.map +1 -0
- package/lib/module/app/components/User.js +109 -0
- package/lib/module/app/components/User.js.map +1 -0
- package/lib/module/app/components/index.js +10 -0
- package/lib/module/app/components/index.js.map +1 -0
- package/lib/module/app/database/clients.js +149 -0
- package/lib/module/app/database/clients.js.map +1 -0
- package/lib/module/app/database/database.js +9 -0
- package/lib/module/app/database/database.js.map +1 -0
- package/lib/module/app/database/schema.js +525 -0
- package/lib/module/app/database/schema.js.map +1 -0
- package/lib/module/app/navigation/BottomTabs/BottomTabs.js +29 -0
- package/lib/module/app/navigation/BottomTabs/BottomTabs.js.map +1 -0
- package/lib/module/app/navigation/Drawer/Drawer.js +13 -0
- package/lib/module/app/navigation/Drawer/Drawer.js.map +1 -0
- package/lib/module/app/navigation/HomeStack/HomeStack.js +36 -0
- package/lib/module/app/navigation/HomeStack/HomeStack.js.map +1 -0
- package/lib/module/app/navigation/Root.js +26 -0
- package/lib/module/app/navigation/Root.js.map +1 -0
- package/lib/module/app/navigation/index.js +7 -0
- package/lib/module/app/navigation/index.js.map +1 -0
- package/lib/module/app/redux/Store.js +10 -0
- package/lib/module/app/redux/Store.js.map +1 -0
- package/lib/module/app/redux/reducers/client/client_actions.js +2 -0
- package/lib/module/app/redux/reducers/client/client_actions.js.map +1 -0
- package/lib/module/app/redux/reducers/client/client_reducers.js +26 -0
- package/lib/module/app/redux/reducers/client/client_reducers.js.map +1 -0
- package/lib/module/app/redux/reducers/client/client_types.js +7 -0
- package/lib/module/app/redux/reducers/client/client_types.js.map +1 -0
- package/lib/module/app/screens/AddScreen.js +200 -0
- package/lib/module/app/screens/AddScreen.js.map +1 -0
- package/lib/module/app/screens/Banks.js +126 -0
- package/lib/module/app/screens/Banks.js.map +1 -0
- package/lib/module/app/screens/CustomerEntries.js +475 -0
- package/lib/module/app/screens/CustomerEntries.js.map +1 -0
- package/lib/module/app/screens/Customers.js +233 -0
- package/lib/module/app/screens/Customers.js.map +1 -0
- package/lib/module/app/screens/Entry.js +696 -0
- package/lib/module/app/screens/Entry.js.map +1 -0
- package/lib/module/app/screens/HomeScreen.js +176 -0
- package/lib/module/app/screens/HomeScreen.js.map +1 -0
- package/lib/module/app/screens/SelectBusiness.js +201 -0
- package/lib/module/app/screens/SelectBusiness.js.map +1 -0
- package/lib/module/app/screens/Splash.js +51 -0
- package/lib/module/app/screens/Splash.js.map +1 -0
- package/lib/module/app/screens/Suppliers.js +222 -0
- package/lib/module/app/screens/Suppliers.js.map +1 -0
- package/lib/module/app/screens/TransactionDetails.js +301 -0
- package/lib/module/app/screens/TransactionDetails.js.map +1 -0
- package/lib/module/app/screens/index.js +14 -0
- package/lib/module/app/screens/index.js.map +1 -0
- package/lib/module/app/themes/config.js +156 -0
- package/lib/module/app/themes/config.js.map +1 -0
- package/lib/module/app/utils/countries.json +1930 -0
- package/lib/module/declarations.d.js +2 -0
- package/lib/module/declarations.d.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/babel.config.d.ts +10 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/eslint.config.d.mts +3 -0
- package/lib/typescript/eslint.config.d.mts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/App.d.ts +2 -0
- package/lib/typescript/src/App.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Balance.d.ts +8 -0
- package/lib/typescript/src/app/components/Balance.d.ts.map +1 -0
- package/lib/typescript/src/app/components/CountryPhoneInput.d.ts +6 -0
- package/lib/typescript/src/app/components/CountryPhoneInput.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Entries.d.ts +4 -0
- package/lib/typescript/src/app/components/Entries.d.ts.map +1 -0
- package/lib/typescript/src/app/components/SearchBar.d.ts +6 -0
- package/lib/typescript/src/app/components/SearchBar.d.ts.map +1 -0
- package/lib/typescript/src/app/components/Transaction.d.ts +11 -0
- package/lib/typescript/src/app/components/Transaction.d.ts.map +1 -0
- package/lib/typescript/src/app/components/User.d.ts +10 -0
- package/lib/typescript/src/app/components/User.d.ts.map +1 -0
- package/lib/typescript/src/app/components/index.d.ts +8 -0
- package/lib/typescript/src/app/components/index.d.ts.map +1 -0
- package/lib/typescript/src/app/database/clients.d.ts +9 -0
- package/lib/typescript/src/app/database/clients.d.ts.map +1 -0
- package/lib/typescript/src/app/database/database.d.ts +3 -0
- package/lib/typescript/src/app/database/database.d.ts.map +1 -0
- package/lib/typescript/src/app/database/schema.d.ts +2 -0
- package/lib/typescript/src/app/database/schema.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts +2 -0
- package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/Drawer/Drawer.d.ts +2 -0
- package/lib/typescript/src/app/navigation/Drawer/Drawer.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts +2 -0
- package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/Root.d.ts +2 -0
- package/lib/typescript/src/app/navigation/Root.d.ts.map +1 -0
- package/lib/typescript/src/app/navigation/index.d.ts +5 -0
- package/lib/typescript/src/app/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/app/redux/Store.d.ts +2 -0
- package/lib/typescript/src/app/redux/Store.d.ts.map +1 -0
- package/lib/typescript/src/app/redux/reducers/client/client_actions.d.ts +1 -0
- package/lib/typescript/src/app/redux/reducers/client/client_actions.d.ts.map +1 -0
- package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts +3 -0
- package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts.map +1 -0
- package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts +5 -0
- package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/AddScreen.d.ts +5 -0
- package/lib/typescript/src/app/screens/AddScreen.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Banks.d.ts +2 -0
- package/lib/typescript/src/app/screens/Banks.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/CustomerEntries.d.ts +5 -0
- package/lib/typescript/src/app/screens/CustomerEntries.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Customers.d.ts +4 -0
- package/lib/typescript/src/app/screens/Customers.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Entry.d.ts +5 -0
- package/lib/typescript/src/app/screens/Entry.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/HomeScreen.d.ts +4 -0
- package/lib/typescript/src/app/screens/HomeScreen.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/SelectBusiness.d.ts +4 -0
- package/lib/typescript/src/app/screens/SelectBusiness.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Splash.d.ts +4 -0
- package/lib/typescript/src/app/screens/Splash.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/Suppliers.d.ts +4 -0
- package/lib/typescript/src/app/screens/Suppliers.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/TransactionDetails.d.ts +5 -0
- package/lib/typescript/src/app/screens/TransactionDetails.d.ts.map +1 -0
- package/lib/typescript/src/app/screens/index.d.ts +12 -0
- package/lib/typescript/src/app/screens/index.d.ts.map +1 -0
- package/lib/typescript/src/app/themes/config.d.ts +63 -0
- package/lib/typescript/src/app/themes/config.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/App.js +41 -0
- package/src/app/assets/Icons/Bill.png +0 -0
- package/src/app/assets/Icons/Cash.png +0 -0
- package/src/app/assets/Icons/Expense.png +0 -0
- package/src/app/assets/Icons/Staff.png +0 -0
- package/src/app/assets/Icons/Stock.png +0 -0
- package/src/app/assets/images/bill.png +0 -0
- package/src/app/assets/images/book.png +0 -0
- package/src/app/assets/images/digiKhataSolo256.png +0 -0
- package/src/app/assets/images/money.png +0 -0
- package/src/app/assets/images/staff.png +0 -0
- package/src/app/assets/images/stock.png +0 -0
- package/src/app/assets/images/svgviewer-png-output-white.png +0 -0
- package/src/app/components/Balance.js +122 -0
- package/src/app/components/CountryPhoneInput.js +286 -0
- package/src/app/components/Entries.js +75 -0
- package/src/app/components/SearchBar.js +64 -0
- package/src/app/components/Transaction.js +91 -0
- package/src/app/components/User.js +85 -0
- package/src/app/components/index.js +15 -0
- package/src/app/database/clients.js +207 -0
- package/src/app/database/database.js +9 -0
- package/src/app/database/schema.js +525 -0
- package/src/app/navigation/BottomTabs/BottomTabs.js +27 -0
- package/src/app/navigation/Drawer/Drawer.js +10 -0
- package/src/app/navigation/HomeStack/HomeStack.js +43 -0
- package/src/app/navigation/Root.js +32 -0
- package/src/app/navigation/index.js +9 -0
- package/src/app/redux/Store.js +9 -0
- package/src/app/redux/reducers/client/client_actions.js +0 -0
- package/src/app/redux/reducers/client/client_reducers.js +30 -0
- package/src/app/redux/reducers/client/client_types.js +5 -0
- package/src/app/screens/AddScreen.js +185 -0
- package/src/app/screens/Banks.js +151 -0
- package/src/app/screens/CustomerEntries.js +402 -0
- package/src/app/screens/Customers.js +240 -0
- package/src/app/screens/Entry.js +658 -0
- package/src/app/screens/HomeScreen.js +146 -0
- package/src/app/screens/SelectBusiness.js +177 -0
- package/src/app/screens/Splash.js +43 -0
- package/src/app/screens/Suppliers.js +228 -0
- package/src/app/screens/TransactionDetails.js +199 -0
- package/src/app/screens/index.js +23 -0
- package/src/app/themes/config.js +185 -0
- package/src/app/utils/countries.json +1930 -0
- package/src/declarations.d.ts +1 -0
- package/src/index.tsx +3 -0
package/src/App.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Text, View, StatusBar } from 'react-native'
|
|
2
|
+
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
3
|
+
import { COLORS, FONT_BOLD, FONT_MEDIUM, FONT_NORMAL } from './app/themes/config'
|
|
4
|
+
import { NavigationContainer } from "@react-navigation/native";
|
|
5
|
+
import Root from './app/navigation/Root';
|
|
6
|
+
import { SafeAreaView, SafeAreaProvider, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
|
+
import React, { useEffect } from 'react';
|
|
8
|
+
import { createTables } from './app/database/schema';
|
|
9
|
+
import { Provider } from "react-redux";
|
|
10
|
+
import { store } from './app/redux/Store';
|
|
11
|
+
|
|
12
|
+
const CustomStatusBar = () => {
|
|
13
|
+
const insets = useSafeAreaInsets();
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
createTables();
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={{ height: insets.top, backgroundColor: COLORS.primaryColor }}>
|
|
21
|
+
<StatusBar
|
|
22
|
+
translucent
|
|
23
|
+
backgroundColor={COLORS.primaryColor}
|
|
24
|
+
barStyle="light-content"
|
|
25
|
+
/>
|
|
26
|
+
</View>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function App() {
|
|
31
|
+
return (
|
|
32
|
+
<SafeAreaProvider>
|
|
33
|
+
<Provider store={store}>
|
|
34
|
+
<CustomStatusBar />
|
|
35
|
+
<NavigationContainer>
|
|
36
|
+
<Root />
|
|
37
|
+
</NavigationContainer>
|
|
38
|
+
</Provider>
|
|
39
|
+
</SafeAreaProvider>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { COLORS, FONT_BOLD, FONT_MEDIUM, FONT_NORMAL, HP, WP } from '../themes/config'
|
|
4
|
+
import LinearGradient from 'react-native-linear-gradient'
|
|
5
|
+
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
6
|
+
|
|
7
|
+
export default function Balance({ greenTitle, redTitle, greenValue, redValue,rightColor = "red" }) {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<LinearGradient
|
|
11
|
+
colors={[COLORS.primaryColor, COLORS.secondaryColor]}
|
|
12
|
+
style={Styles._grdientContainer}
|
|
13
|
+
start={{ x: 0, y: 0 }}
|
|
14
|
+
end={{ x: 1, y: 0 }}
|
|
15
|
+
/>
|
|
16
|
+
<View style={Styles._mainContainer}>
|
|
17
|
+
<View style={Styles._balanceHeader}>
|
|
18
|
+
<TouchableOpacity
|
|
19
|
+
activeOpacity={0.8}
|
|
20
|
+
>
|
|
21
|
+
<Text style={Styles._hideTxt}>Hide Balance</Text>
|
|
22
|
+
</TouchableOpacity>
|
|
23
|
+
</View>
|
|
24
|
+
<TouchableOpacity
|
|
25
|
+
style={Styles._balanceContent}
|
|
26
|
+
activeOpacity={0.8}
|
|
27
|
+
>
|
|
28
|
+
<View style={Styles._balanceSection}>
|
|
29
|
+
<Text style={[Styles._balanceValue, { fontSize: 14 }]}>Rs {greenValue}</Text>
|
|
30
|
+
<Text style={[Styles._balanceValue, { color: COLORS.darkGrey, fontFamily: FONT_NORMAL }]}>{greenTitle}</Text>
|
|
31
|
+
</View>
|
|
32
|
+
|
|
33
|
+
<View style={Styles._balanceSection}>
|
|
34
|
+
<Text style={[Styles._balanceValue, { color: rightColor, fontSize: 14 }]}>Rs {redValue}</Text>
|
|
35
|
+
<Text style={[Styles._balanceValue, { color: COLORS.darkGrey, fontFamily: FONT_NORMAL }]}>{redTitle}</Text>
|
|
36
|
+
</View>
|
|
37
|
+
|
|
38
|
+
<TouchableOpacity
|
|
39
|
+
style={Styles._iconMain}
|
|
40
|
+
activeOpacity={0.8}
|
|
41
|
+
>
|
|
42
|
+
<Ionicons
|
|
43
|
+
name={"chevron-forward"}
|
|
44
|
+
color={COLORS.primaryColor}
|
|
45
|
+
size={25}
|
|
46
|
+
/>
|
|
47
|
+
</TouchableOpacity>
|
|
48
|
+
</TouchableOpacity>
|
|
49
|
+
</View>
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const Styles = StyleSheet.create({
|
|
55
|
+
_mainContainer: {
|
|
56
|
+
width: WP(94),
|
|
57
|
+
// height: HP(11),
|
|
58
|
+
backgroundColor: COLORS.whiteColor,
|
|
59
|
+
borderRadius: 12,
|
|
60
|
+
shadowColor: "#000",
|
|
61
|
+
shadowOffset: {
|
|
62
|
+
width: 0,
|
|
63
|
+
height: 2,
|
|
64
|
+
},
|
|
65
|
+
shadowOpacity: 0.15,
|
|
66
|
+
shadowRadius: 3.84,
|
|
67
|
+
elevation: 5,
|
|
68
|
+
marginTop: 10,
|
|
69
|
+
position: "absolute",
|
|
70
|
+
paddingHorizontal: 12,
|
|
71
|
+
paddingVertical: 10,
|
|
72
|
+
},
|
|
73
|
+
_grdientContainer: {
|
|
74
|
+
width: WP(100),
|
|
75
|
+
height: HP(5),
|
|
76
|
+
// backgroundColor: "red",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
},
|
|
79
|
+
_balanceHeader: {
|
|
80
|
+
width: "100%",
|
|
81
|
+
// height: 20,
|
|
82
|
+
// backgroundColor:"red"
|
|
83
|
+
},
|
|
84
|
+
_hideTxt: {
|
|
85
|
+
color: COLORS.primaryColor,
|
|
86
|
+
fontFamily: FONT_MEDIUM,
|
|
87
|
+
fontSize: 12,
|
|
88
|
+
},
|
|
89
|
+
_balanceContent: {
|
|
90
|
+
width: "100%",
|
|
91
|
+
height: "70%",
|
|
92
|
+
// backgroundColor:"red",
|
|
93
|
+
justifyContent: "center",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
flexDirection: "row",
|
|
96
|
+
marginTop: 5,
|
|
97
|
+
paddingVertical: 4,
|
|
98
|
+
},
|
|
99
|
+
_balanceSection: {
|
|
100
|
+
width: "40%",
|
|
101
|
+
height: "100%",
|
|
102
|
+
// backgroundColor: "red",
|
|
103
|
+
justifyContent: "center",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
borderRightColor: COLORS.blackColor,
|
|
106
|
+
borderRightWidth: 0.7
|
|
107
|
+
},
|
|
108
|
+
_balanceValue: {
|
|
109
|
+
color: "green",
|
|
110
|
+
fontFamily: FONT_MEDIUM,
|
|
111
|
+
fontSize: 11,
|
|
112
|
+
textAlign:"center"
|
|
113
|
+
},
|
|
114
|
+
_iconMain: {
|
|
115
|
+
width: "20%",
|
|
116
|
+
height: "100%",
|
|
117
|
+
// backgroundColor: "red",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
paddingLeft: 10
|
|
121
|
+
},
|
|
122
|
+
})
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TextInput,
|
|
8
|
+
FlatList,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
import Modal from "react-native-modal";
|
|
11
|
+
import { COLORS, FONT_MEDIUM, FONT_NORMAL } from "../themes/config";
|
|
12
|
+
import countries from "../utils/countries.json";
|
|
13
|
+
import Ionicons from "react-native-vector-icons/Ionicons"
|
|
14
|
+
|
|
15
|
+
export default function CountryPhoneInput({
|
|
16
|
+
initialCountryCode = "PK",
|
|
17
|
+
phonePlaceholder = "Enter phone number",
|
|
18
|
+
onChange,
|
|
19
|
+
}) {
|
|
20
|
+
const defaultCountry =
|
|
21
|
+
countries.find((c) => c.code === initialCountryCode) || countries[0];
|
|
22
|
+
|
|
23
|
+
const [isModalVisible, setModalVisible] = useState(false);
|
|
24
|
+
const [selectedCountry, setSelectedCountry] = useState(defaultCountry);
|
|
25
|
+
const [phoneNumber, setPhoneNumber] = useState("");
|
|
26
|
+
const [query, setQuery] = useState("");
|
|
27
|
+
|
|
28
|
+
const toggleModal = () => setModalVisible((p) => !p);
|
|
29
|
+
|
|
30
|
+
const filteredCountries = useMemo(() => {
|
|
31
|
+
const q = query.trim().toLowerCase();
|
|
32
|
+
if (!q) return countries;
|
|
33
|
+
return countries.filter(
|
|
34
|
+
(c) =>
|
|
35
|
+
c.name.toLowerCase().includes(q) ||
|
|
36
|
+
c.code.toLowerCase().includes(q) ||
|
|
37
|
+
c.dial_code.toLowerCase().includes(q)
|
|
38
|
+
);
|
|
39
|
+
}, [query]);
|
|
40
|
+
|
|
41
|
+
const handleSelectCountry = (country) => {
|
|
42
|
+
setSelectedCountry(country);
|
|
43
|
+
toggleModal();
|
|
44
|
+
// propagate change after country changes
|
|
45
|
+
if (onChange) {
|
|
46
|
+
onChange({
|
|
47
|
+
country,
|
|
48
|
+
phone: phoneNumber,
|
|
49
|
+
fullNumber: `${country.dial_code}${phoneNumber}`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handlePhoneChange = (text) => {
|
|
55
|
+
// keep only digits in the phone input; dial code already shown on left
|
|
56
|
+
const digitsOnly = text.replace(/[^\d]/g, "");
|
|
57
|
+
setPhoneNumber(digitsOnly);
|
|
58
|
+
if (onChange) {
|
|
59
|
+
onChange({
|
|
60
|
+
country: selectedCountry,
|
|
61
|
+
phone: digitsOnly,
|
|
62
|
+
fullNumber: `${selectedCountry.dial_code}${digitsOnly}`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<View style={Styles._mainContainer}>
|
|
69
|
+
{/* Country Picker */}
|
|
70
|
+
<TouchableOpacity
|
|
71
|
+
style={Styles._pickerMain}
|
|
72
|
+
activeOpacity={0.8}
|
|
73
|
+
onPress={toggleModal}
|
|
74
|
+
>
|
|
75
|
+
<Text style={Styles._emoji}>{selectedCountry.emoji}</Text>
|
|
76
|
+
<Text style={Styles._dialCode}>{selectedCountry.dial_code}</Text>
|
|
77
|
+
<Ionicons
|
|
78
|
+
name={"chevron-down"}
|
|
79
|
+
color={COLORS.primaryColor}
|
|
80
|
+
size={18}
|
|
81
|
+
/>
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
|
|
84
|
+
{/* Phone Input */}
|
|
85
|
+
<TextInput
|
|
86
|
+
style={Styles._input}
|
|
87
|
+
placeholder={phonePlaceholder}
|
|
88
|
+
keyboardType="phone-pad"
|
|
89
|
+
value={phoneNumber}
|
|
90
|
+
onChangeText={handlePhoneChange}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
{/* Country Modal with Search */}
|
|
94
|
+
<Modal
|
|
95
|
+
isVisible={isModalVisible}
|
|
96
|
+
onBackdropPress={toggleModal}
|
|
97
|
+
onBackButtonPress={toggleModal}
|
|
98
|
+
useNativeDriver
|
|
99
|
+
>
|
|
100
|
+
<View style={Styles._modalContent}>
|
|
101
|
+
<View style={Styles._modalHeader}>
|
|
102
|
+
<Text style={Styles._modalTitle}>Select country</Text>
|
|
103
|
+
<TouchableOpacity onPress={toggleModal} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }}>
|
|
104
|
+
<Text style={Styles._closeText}>Close</Text>
|
|
105
|
+
</TouchableOpacity>
|
|
106
|
+
</View>
|
|
107
|
+
|
|
108
|
+
<View style={Styles._searchWrap}>
|
|
109
|
+
<TextInput
|
|
110
|
+
value={query}
|
|
111
|
+
onChangeText={setQuery}
|
|
112
|
+
placeholder="Search by country, code or +dial"
|
|
113
|
+
autoCorrect={false}
|
|
114
|
+
autoCapitalize="none"
|
|
115
|
+
style={Styles._searchInput}
|
|
116
|
+
clearButtonMode="while-editing"
|
|
117
|
+
/>
|
|
118
|
+
{/* {query.length > 0 && (
|
|
119
|
+
<TouchableOpacity
|
|
120
|
+
onPress={() => setQuery("")}
|
|
121
|
+
style={Styles._clearBtn}
|
|
122
|
+
>
|
|
123
|
+
<Text style={Styles._clearBtnText}>×</Text>
|
|
124
|
+
</TouchableOpacity>
|
|
125
|
+
)} */}
|
|
126
|
+
</View>
|
|
127
|
+
|
|
128
|
+
<FlatList
|
|
129
|
+
data={filteredCountries}
|
|
130
|
+
keyExtractor={(item) => item.code}
|
|
131
|
+
keyboardShouldPersistTaps="handled"
|
|
132
|
+
showsVerticalScrollIndicator={false}
|
|
133
|
+
renderItem={({ item, index }) => {
|
|
134
|
+
const isSelected = item.code === selectedCountry.code;
|
|
135
|
+
return (
|
|
136
|
+
<TouchableOpacity
|
|
137
|
+
style={Styles._countryItem}
|
|
138
|
+
onPress={() => handleSelectCountry(item)}
|
|
139
|
+
key={index}
|
|
140
|
+
>
|
|
141
|
+
<Text style={Styles._emoji}>{item.emoji}</Text>
|
|
142
|
+
<View style={{ flex: 1, marginLeft: 10 }}>
|
|
143
|
+
<Text
|
|
144
|
+
style={[
|
|
145
|
+
Styles._countryName,
|
|
146
|
+
isSelected && Styles._countryNameSelected,
|
|
147
|
+
]}
|
|
148
|
+
>
|
|
149
|
+
{item.name}
|
|
150
|
+
</Text>
|
|
151
|
+
<Text style={Styles._countryMeta}>
|
|
152
|
+
{item.code} · {item.dial_code}
|
|
153
|
+
</Text>
|
|
154
|
+
</View>
|
|
155
|
+
{isSelected ? <Text style={Styles._tick}>✓</Text> : null}
|
|
156
|
+
</TouchableOpacity>
|
|
157
|
+
);
|
|
158
|
+
}}
|
|
159
|
+
ListEmptyComponent={
|
|
160
|
+
<View style={Styles._emptyWrap}>
|
|
161
|
+
<Text style={Styles._emptyText}>No matches</Text>
|
|
162
|
+
</View>
|
|
163
|
+
}
|
|
164
|
+
/>
|
|
165
|
+
</View>
|
|
166
|
+
</Modal>
|
|
167
|
+
</View>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const Styles = StyleSheet.create({
|
|
172
|
+
_mainContainer: {
|
|
173
|
+
width: "95%",
|
|
174
|
+
height: 50,
|
|
175
|
+
backgroundColor: COLORS.whiteColor,
|
|
176
|
+
borderRadius: 15,
|
|
177
|
+
borderColor: COLORS.grey,
|
|
178
|
+
borderWidth: 1,
|
|
179
|
+
flexDirection: "row",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
paddingHorizontal: 10,
|
|
182
|
+
},
|
|
183
|
+
_pickerMain: {
|
|
184
|
+
// width: "25%",
|
|
185
|
+
height: "80%",
|
|
186
|
+
flexDirection: "row",
|
|
187
|
+
justifyContent: "space-between",
|
|
188
|
+
alignItems: "center",
|
|
189
|
+
borderRightColor: COLORS.gray,
|
|
190
|
+
borderRightWidth: 0.7,
|
|
191
|
+
gap: 5,
|
|
192
|
+
paddingHorizontal: 5
|
|
193
|
+
// backgroundColor: "red"
|
|
194
|
+
},
|
|
195
|
+
_emoji: {
|
|
196
|
+
fontSize: 25,
|
|
197
|
+
},
|
|
198
|
+
_dialCode: {
|
|
199
|
+
fontSize: 13,
|
|
200
|
+
// fontWeight: "600",
|
|
201
|
+
fontFamily: FONT_NORMAL
|
|
202
|
+
},
|
|
203
|
+
_input: {
|
|
204
|
+
flex: 1,
|
|
205
|
+
height: "100%",
|
|
206
|
+
paddingHorizontal: 10,
|
|
207
|
+
fontSize: 16,
|
|
208
|
+
color: COLORS.black,
|
|
209
|
+
},
|
|
210
|
+
_modalContent: {
|
|
211
|
+
backgroundColor: COLORS.whiteColor,
|
|
212
|
+
borderRadius: 12,
|
|
213
|
+
padding: 12,
|
|
214
|
+
maxHeight: "75%",
|
|
215
|
+
},
|
|
216
|
+
_modalHeader: {
|
|
217
|
+
flexDirection: "row",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
justifyContent: "space-between",
|
|
220
|
+
marginBottom: 8,
|
|
221
|
+
},
|
|
222
|
+
_modalTitle: {
|
|
223
|
+
fontSize: 15,
|
|
224
|
+
fontFamily: FONT_MEDIUM
|
|
225
|
+
// fontWeight: "700",
|
|
226
|
+
},
|
|
227
|
+
_closeText: {
|
|
228
|
+
fontSize: 13,
|
|
229
|
+
fontFamily: FONT_NORMAL
|
|
230
|
+
},
|
|
231
|
+
_searchWrap: {
|
|
232
|
+
flexDirection: "row",
|
|
233
|
+
alignItems: "center",
|
|
234
|
+
borderWidth: 1,
|
|
235
|
+
borderColor: COLORS.grey,
|
|
236
|
+
borderRadius: 10,
|
|
237
|
+
paddingHorizontal: 10,
|
|
238
|
+
height: 42,
|
|
239
|
+
marginBottom: 8,
|
|
240
|
+
},
|
|
241
|
+
_searchInput: {
|
|
242
|
+
flex: 1,
|
|
243
|
+
fontSize: 13,
|
|
244
|
+
fontFamily: FONT_NORMAL,
|
|
245
|
+
},
|
|
246
|
+
_clearBtn: {
|
|
247
|
+
paddingHorizontal: 6,
|
|
248
|
+
paddingVertical: 2,
|
|
249
|
+
},
|
|
250
|
+
_clearBtnText: {
|
|
251
|
+
fontSize: 20,
|
|
252
|
+
lineHeight: 20,
|
|
253
|
+
},
|
|
254
|
+
_countryItem: {
|
|
255
|
+
flexDirection: "row",
|
|
256
|
+
alignItems: "center",
|
|
257
|
+
paddingVertical: 12,
|
|
258
|
+
borderBottomColor: COLORS.grey,
|
|
259
|
+
borderBottomWidth: 0.5,
|
|
260
|
+
},
|
|
261
|
+
_countryName: {
|
|
262
|
+
fontSize: 14,
|
|
263
|
+
fontFamily: FONT_NORMAL
|
|
264
|
+
},
|
|
265
|
+
_countryNameSelected: {
|
|
266
|
+
fontWeight: "700",
|
|
267
|
+
},
|
|
268
|
+
_countryMeta: {
|
|
269
|
+
fontSize: 10,
|
|
270
|
+
opacity: 0.7,
|
|
271
|
+
fontFamily: FONT_NORMAL
|
|
272
|
+
},
|
|
273
|
+
_tick: {
|
|
274
|
+
fontSize: 18,
|
|
275
|
+
marginLeft: 8,
|
|
276
|
+
},
|
|
277
|
+
_emptyWrap: {
|
|
278
|
+
paddingVertical: 24,
|
|
279
|
+
alignItems: "center",
|
|
280
|
+
},
|
|
281
|
+
_emptyText: {
|
|
282
|
+
fontSize: 14,
|
|
283
|
+
opacity: 0.6,
|
|
284
|
+
fontFamily: FONT_NORMAL
|
|
285
|
+
},
|
|
286
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { View, Text, StyleSheet, TouchableOpacity, Image, FlatList } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { COLORS, FONT_NORMAL, HP, WP } from '../themes/config'
|
|
4
|
+
|
|
5
|
+
export default function Entries({ marginTop }) {
|
|
6
|
+
|
|
7
|
+
const data = [
|
|
8
|
+
{
|
|
9
|
+
name: "Cash",
|
|
10
|
+
icon: require("../assets/Icons/Cash.png")
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "Stock",
|
|
14
|
+
icon: require("../assets/Icons/Stock.png")
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "Bill",
|
|
18
|
+
icon: require("../assets/Icons/Bill.png")
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "Staff",
|
|
22
|
+
icon: require("../assets/Icons/Staff.png")
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "Expense",
|
|
26
|
+
icon: require("../assets/Icons/Expense.png")
|
|
27
|
+
},
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View style={[Styles._mainContainer, { marginTop }]}>
|
|
32
|
+
<FlatList
|
|
33
|
+
data={data}
|
|
34
|
+
horizontal
|
|
35
|
+
showsHorizontalScrollIndicator={false}
|
|
36
|
+
scrollEnabled={false}
|
|
37
|
+
keyExtractor={(item, index) => index.toString()}
|
|
38
|
+
renderItem={({ item, index }) => (
|
|
39
|
+
<TouchableOpacity activeOpacity={0.8} style={Styles._listItem} key={index}>
|
|
40
|
+
<Image source={item.icon} style={{ width: HP(3), height: HP(3), resizeMode: "contain" }}/>
|
|
41
|
+
<Text style={{ color: COLORS.blackColor, fontSize: WP(2.5), fontFamily: FONT_NORMAL, textAlign: "center" }}>{item.name.toLocaleUpperCase()}</Text>
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
</View>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const Styles = StyleSheet.create({
|
|
50
|
+
_mainContainer: {
|
|
51
|
+
width: WP(94),
|
|
52
|
+
// height: 20,
|
|
53
|
+
// backgroundColor: "red",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
},
|
|
56
|
+
_listItem: {
|
|
57
|
+
width: HP(7.5),
|
|
58
|
+
height: HP(7.5),
|
|
59
|
+
backgroundColor: COLORS.whiteColor,
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
marginHorizontal: 5,
|
|
63
|
+
shadowColor: "#000",
|
|
64
|
+
shadowOffset: {
|
|
65
|
+
width: 0,
|
|
66
|
+
height: 2,
|
|
67
|
+
},
|
|
68
|
+
shadowOpacity: 0.2,
|
|
69
|
+
shadowRadius: 3.84,
|
|
70
|
+
elevation: 5,
|
|
71
|
+
borderRadius: 14,
|
|
72
|
+
marginVertical: HP(1),
|
|
73
|
+
gap: 7
|
|
74
|
+
}
|
|
75
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TextInput, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
4
|
+
import { COLORS } from '../themes/config';
|
|
5
|
+
|
|
6
|
+
const SearchBar = ({ placeholder = "Search...", onChangeText }) => {
|
|
7
|
+
const [searchText, setSearchText] = useState('');
|
|
8
|
+
|
|
9
|
+
const handleChange = (text) => {
|
|
10
|
+
setSearchText(text);
|
|
11
|
+
if (onChangeText) {
|
|
12
|
+
onChangeText(text);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const clearInput = () => {
|
|
17
|
+
setSearchText('');
|
|
18
|
+
if (onChangeText) {
|
|
19
|
+
onChangeText('');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<View style={styles.container}>
|
|
25
|
+
<Ionicons name="search" size={20} color="#888" style={styles.icon} />
|
|
26
|
+
<TextInput
|
|
27
|
+
style={styles.input}
|
|
28
|
+
placeholder={placeholder}
|
|
29
|
+
placeholderTextColor="#888"
|
|
30
|
+
value={searchText}
|
|
31
|
+
onChangeText={handleChange}
|
|
32
|
+
/>
|
|
33
|
+
{searchText.length > 0 && (
|
|
34
|
+
<TouchableOpacity onPress={clearInput}>
|
|
35
|
+
<Ionicons name="close-circle" size={20} color="#888" />
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
)}
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
container: {
|
|
44
|
+
flexDirection: 'row',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
backgroundColor: COLORS.whiteColor,
|
|
47
|
+
borderRadius: 10,
|
|
48
|
+
paddingHorizontal: 10,
|
|
49
|
+
// marginVertical: 10,
|
|
50
|
+
height: 40,
|
|
51
|
+
borderColor: COLORS.gray,
|
|
52
|
+
borderWidth: 1
|
|
53
|
+
},
|
|
54
|
+
icon: {
|
|
55
|
+
marginRight: 8,
|
|
56
|
+
},
|
|
57
|
+
input: {
|
|
58
|
+
flex: 1,
|
|
59
|
+
fontSize: 16,
|
|
60
|
+
color: '#000',
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export default SearchBar;
|