Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#95 + #96: To-do facturen + automatische deployment #20

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: 📦 Install dependencies
run: npm i install

- name: 🚀 Build and submit app
run: eas build --non-interactive --profile production --platform all --auto-submit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ web-build/
.env
.vscode/
_distrobution/
build-*.apk
build-*.tar.gz
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.5.12
* \#96 Facturen tonen in de app waar de gebruikers (degene die ingelogd is) iets mee moet/kan.
* \#95 Automatiseren Deployment

# v1.5.11
* \#97 Custom Blue10-header toevoegen aan Webview requests
* \#98 Scan-knop voor alle gebruikers tonen
Expand Down
365 changes: 190 additions & 175 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blue10-app",
"version": "1.5.11",
"version": "1.5.12",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start --dev-client",
Expand All @@ -20,48 +20,48 @@
},
"dependencies": {
"@expo/react-native-action-sheet": "^4.0.1",
"@formatjs/intl-getcanonicallocales": "^2.2.1",
"@formatjs/intl-locale": "^3.3.4",
"@formatjs/intl-numberformat": "^8.7.2",
"@formatjs/intl-pluralrules": "^5.2.6",
"@formatjs/intl-getcanonicallocales": "^2.3.0",
"@formatjs/intl-locale": "^3.4.0",
"@formatjs/intl-numberformat": "^8.8.0",
"@formatjs/intl-pluralrules": "^5.2.7",
"@react-native-material/core": "^1.3.7",
"@react-native-segmented-control/segmented-control": "2.4.1",
"@react-navigation/native": "^6.1.7",
"@react-navigation/native-stack": "^6.9.13",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.15",
"@sentry/react-native": "5.5.0",
"@tanstack/react-query": "^4.36.1",
"@types/react": "~18.2.28",
"@types/semver": "^7.5.1",
"@types/react": "~18.2.30",
"@types/semver": "^7.5.4",
"@wecreatesolutions/config-eslint": "^0.1.0",
"axios": "^1.5.0",
"axios": "^1.5.1",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
"expo": "^49.0.13",
"expo-application": "~5.3.0",
"expo": "^49.0.16",
"expo-application": "~5.3.1",
"expo-constants": "~14.4.2",
"expo-dev-client": "~2.4.11",
"expo-device": "~5.4.0",
"expo-image-manipulator": "~11.3.0",
"expo-localization": "~14.3.0",
"expo-secure-store": "~12.3.1",
"expo-status-bar": "~1.6.0",
"i18next": "^23.5.1",
"i18next": "^23.6.0",
"jwt-decode": "^3.1.2",
"react": "18.2.0",
"react-content-loader": "^6.2.1",
"react-i18next": "^13.3.0",
"react-native": "0.72.5",
"react-native-document-scanner-plugin": "^0.9.0",
"react-native-gesture-handler": "~2.12.0",
"react-i18next": "^13.3.1",
"react-native": "0.72.6",
"react-native-document-scanner-plugin": "^0.9.1",
"react-native-gesture-handler": "~2.12.1",
"react-native-images-to-pdf": "^0.2.1",
"react-native-pager-view": "6.2.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-screens": "~3.22.1",
"react-native-svg": "13.9.0",
"react-native-svg-transformer": "^1.1.0",
"react-native-webview": "13.2.2",
"semver": "^7.5.4",
"sentry-expo": "^7.0.1",
"sentry-expo": "~7.0.1",
"typescript": "^5.2.2",
"unique-slug": "^4.0.0",
"zustand": "^4.4.3"
Expand Down
8 changes: 4 additions & 4 deletions src/Screens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { InvoiceDetailsScreen } from './screens/InvoiceDetailsScreen';
import { InvoiceOriginalsScreen } from './screens/InvoiceOriginalsScreen';
import { InvoiceSelectActionScreen } from './screens/InvoiceSelectActionScreen';
import { InvoiceSelectUserScreen } from './screens/InvoiceSelectUserScreen';
import { InvoicesToApproveScreen } from './screens/InvoicesToApproveScreen';
import { InvoicesToDoScreen } from './screens/InvoicesToDoScreen';
import { InvoiceTimelineScreen } from './screens/InvoiceTimelineScreen';
import { ScanPreviewScreen } from './screens/ScanPreviewScreen';
import { ScanSelectCompanyScreen } from './screens/ScanSelectCompanyScreen';
Expand Down Expand Up @@ -54,10 +54,10 @@ const Screens: React.FC = () => {
}}
/>
<Stack.Screen
name="InvoicesToApproveScreen"
component={InvoicesToApproveScreen}
name="InvoicesToDoScreen"
component={InvoicesToDoScreen}
options={{
title: t('to_approved_invoices.screen_title'),
title: t('to_do_invoices.screen_title'),
}}
/>
<Stack.Screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Platform, StyleSheet } from 'react-native';

import ArrowLeftIcon from '../../../assets/icons/arrow-round-left.svg';
import ArrowRightIcon from '../../../assets/icons/arrow-round-right.svg';
import { useInvoiceToApproveQuery } from '../../hooks/queries/useInvoiceToApproveQuery';
import { useInvoiceToDoQuery } from '../../hooks/queries/useInvoiceToDoQuery';
import { colors } from '../../theme';
import Box from '../Box/Box';
import Button from '../Button/Button';
Expand Down Expand Up @@ -34,7 +34,7 @@ export const InvoiceDetailsNavigation: React.FC<Props> = (
hasNextPage,
fetchNextPage,
},
} = useInvoiceToApproveQuery();
} = useInvoiceToDoQuery();

const indexInInvoice = getIndexById(currentInvoiceId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Props = {
index: number;
}

export const InvoiceToApproveListItem: React.FC<Props> = (
export const InvoiceToDoListItem: React.FC<Props> = (
{
item,
index,
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoginSite/LoginSite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const LoginSite: React.FC<LoginSiteProps> = ({ mode, refreshToken, onRefreshToke
}}
onMessage={(data) => {
const { url, data: cookieData } = data.nativeEvent;
if (!isUrlFromLogin(url)) {
if (url && !isUrlFromLogin(url)) {
const { refresh_token } = parseCookies(cookieData);
if (refresh_token) {
onRefreshToken(refresh_token, urlToApiUrl(url));
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const enum queryKeys {
environments = 'environments',
invoice = 'invoice',
users = 'users',
invoicesToApprove = 'invoicesToApprove',
invoicesToDo = 'invoicesToDo',
invoiceAttachments = 'invoiceAttachments',
invoicePackingSlips = 'invoicePackingSlips',
invoiceBookings = 'invoiceBookings',
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/invalidate/useInvalidateInvoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const useInvalidateInvoice = () => {
});

queryClient.invalidateQueries([
queryKeys.invoicesToApprove,
queryKeys.invoicesToDo,
`user-${currentUser.currentUser?.Id}`,
`belongs-to-${currentUser.currentUser?.BelongsTo}`,
]);

queryClient.invalidateQueries([
queryKeys.invoicesToApprove,
queryKeys.invoicesToDo,
'totalCount',
`user-${currentUser.currentUser?.Id}`,
`belongs-to-${currentUser.currentUser?.BelongsTo}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { useQueryKeySuffix } from '../../utils/queryUtils';
import { useApi } from '../useApi';
import { useGetCurrentUser } from './useGetCurrentUser';

export const useGetApprovedInvoiceCount = () => {
export const useGetToDoInvoiceCount = () => {
const api = useApi();

const currentUser = useGetCurrentUser();

const query = useQuery(
useQueryKeySuffix([
queryKeys.invoicesToApprove,
queryKeys.invoicesToDo,
'totalCount',
`user-${currentUser.currentUser?.Id}`,
`belongs-to-${currentUser.currentUser?.BelongsTo}`,
Expand All @@ -26,7 +26,7 @@ export const useGetApprovedInvoiceCount = () => {
PageSize: 1,
SortAscending: false,
SortName: 'DocumentDate',
Status: 7,
Status: 11,
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { useQueryKeySuffix } from '../../utils/queryUtils';
import { useApi } from '../useApi';
import { useGetCurrentUser } from './useGetCurrentUser';

export const useInvoiceToApproveQuery = () => {
export const useInvoiceToDoQuery = () => {
const api = useApi();

const currentUser = useGetCurrentUser();

const client = useInfiniteQuery(
useQueryKeySuffix([
queryKeys.invoicesToApprove,
queryKeys.invoicesToDo,
`user-${currentUser.currentUser?.Id}`,
`belongs-to-${currentUser.currentUser?.BelongsTo}`,
]),
Expand All @@ -31,7 +31,7 @@ export const useInvoiceToApproveQuery = () => {
PageSize: 25,
SortAscending: false,
SortName: 'DocumentDate',
Status: 7,
Status: 11,
});

return {
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ export const en: TranslationKeysType = {
switch_environments: {
screen_title: 'Change environment',
},
to_approved_invoices: {
to_do_invoices: {
count_results_header_one: '1 result',
count_results_header_other: '{{count}} results',
count_results_header_zero: '0 results',
screen_title: 'To approve',
screen_title: 'To-do',
},
};
4 changes: 2 additions & 2 deletions src/i18n/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ export const nl: TranslationKeysType = {
switch_environments: {
screen_title: 'Wissel omgeving',
},
to_approved_invoices: {
to_do_invoices: {
count_results_header_one: '1 resultaat',
count_results_header_other: '{{count}} resultaten',
count_results_header_zero: '0 resultaten',
screen_title: 'Goedkeuren',
screen_title: 'To-do',
},
};
2 changes: 1 addition & 1 deletion src/i18n/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type TranslationKeysType = {
welcome_description: string;
title: string;
};
to_approved_invoices: {
to_do_invoices: {
screen_title: string;
count_results_header_zero: string;
count_results_header_one: string;
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type RootStackParamList = {
ScanPreviewScreen: undefined;
ScanSelectCompanyScreen: undefined;
ScanSelectDocumentTypeScreen: undefined;
InvoicesToApproveScreen: { invoices: number } | undefined;
InvoicesToDoScreen: { invoices: number } | undefined;
InvoiceDetailsScreen: { id: string; disabledAnimation?: boolean };
InvoiceSelectUserScreen: { id: string; onlyShowUsers?: string[]; selectedUserId?: string};
InvoiceSelectActionScreen: { id: string; onlyShowActions?: number[]; selectedActionId?: number};
Expand Down
32 changes: 12 additions & 20 deletions src/screens/DashboardScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { DashboardItem } from '../components/DashboardItem/DashboardItem';
import LoaderWrapper from '../components/LoaderWrapper/LoaderWrapper';
import { ScreenWithStatusBarAndHeader } from '../components/ScreenWithStatusBarAndHeader';
import Text from '../components/Text/Text';
import { useGetApprovedInvoiceCount } from '../hooks/queries/useGetApproveInvoicesCount';
import { useGetCurrentCustomer } from '../hooks/queries/useGetCurrentCustomer';
import { useGetCurrentUser } from '../hooks/queries/useGetCurrentUser';
import { useGetToDoInvoiceCount } from '../hooks/queries/useGetToDoInvoicesCount';
import { RootStackParamList } from '../navigation/types';
import { useImageStore } from '../store/ImageStore';
import { colors, dimensions, text } from '../theme/';
Expand All @@ -22,17 +22,17 @@ type Props = NativeStackScreenProps<RootStackParamList, 'Dashboard'>;
export const DashboardScreen: React.FC<Props> = ({ navigation }) => {
const { currentUser, query: { isLoading } } = useGetCurrentUser();
const currentCustomer = useGetCurrentCustomer();
const { count: invoices, isLoading: isCountLoading } = useGetApprovedInvoiceCount();
const { count: invoices, isLoading: isCountLoading } = useGetToDoInvoiceCount();
const { reset: resetScannedImages } = useImageStore();
const { t } = useTranslation();

const onSwitchEnv = () => {
navigation.navigate('SwitchEnvironment');
};

const onApproveInvoices = () => {
const onToDoInvoices = () => {
navigation.navigate(
'InvoicesToApproveScreen',
'InvoicesToDoScreen',
{
invoices: Number(invoices),
},
Expand All @@ -47,12 +47,6 @@ export const DashboardScreen: React.FC<Props> = ({ navigation }) => {
[currentUser],
);

const canUserApprove = useMemo(
// disabled temporarily so app can go into production without this button -- permissions will be determined later
() => false,
[],
);

const startScannerFlow = useCallback(() => {
resetScannedImages();
navigation.navigate('ScanSelectCompanyScreen');
Expand Down Expand Up @@ -82,16 +76,14 @@ export const DashboardScreen: React.FC<Props> = ({ navigation }) => {
<SvgCameraShape color={colors.white} style={{ alignSelf: 'center' }} width={75} height={75} />
</DashboardItem>
)}
{canUserApprove && (
<DashboardItem
isLoading={isCountLoading}
title={t('to_approved_invoices.screen_title')}
color={colors.dashboard.approval.background}
textColor={colors.dashboard.approval.text}
contentTitle={invoices.toString()}
onPress={onApproveInvoices}
/>
)}
<DashboardItem
isLoading={isCountLoading}
title={t('to_do_invoices.screen_title')}
color={colors.dashboard.toDo.background}
textColor={colors.dashboard.toDo.text}
contentTitle={invoices.toString()}
onPress={onToDoInvoices}
/>
{currentUser?.IsInMultipleEnvironments && (
<DashboardItem
isLoading={false}
Expand Down
Loading