@accounter/client 0.0.7-alpha-20251021062721-ab43b5f013b9852ff5216bc141852da9dcfe0df7 → 0.0.8-alpha-20251021150028-9eb73ba6576d67c75a60786d0e4ab0876fd7a95c
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/CHANGELOG.md +102 -105
- package/dist/assets/index-0eCf1BcD.css +1 -0
- package/dist/assets/index-DHTbHvtz.js +1188 -0
- package/dist/assets/{index.es-NOVMdy_X.js → index.es-DHwHzag1.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -2
- package/src/app.tsx +4 -8
- package/src/components/business-transactions/business-extended-info.tsx +13 -9
- package/src/components/charges/charge-extended-info-menu.tsx +21 -27
- package/src/components/charges/charges-row.tsx +10 -12
- package/src/components/charges/charges-table.tsx +9 -15
- package/src/components/common/documents/issue-document/index.tsx +3 -3
- package/src/components/common/documents/issue-document/{recent-business-docs.tsx → recent-client-docs.tsx} +13 -19
- package/src/components/common/forms/business-card.tsx +0 -1
- package/src/components/common/forms/modify-business-fields.tsx +19 -2
- package/src/components/common/inputs/combo-box.tsx +1 -1
- package/src/components/reports/trial-balance-report/trial-balance-report-group.tsx +6 -4
- package/src/components/reports/trial-balance-report/trial-balance-report-sort-code.tsx +11 -8
- package/src/components/screens/documents/issue-documents/edit-issue-document-modal.tsx +4 -4
- package/src/gql/gql.ts +9 -93
- package/src/gql/graphql.ts +20 -285
- package/src/helpers/currency.ts +0 -5
- package/src/helpers/index.ts +0 -2
- package/src/hooks/use-get-all-contracts.ts +1 -0
- package/dist/assets/index-CJB5mMpd.js +0 -1224
- package/dist/assets/index-CzRRUK04.css +0 -1
- package/src/components/business/business-header.tsx +0 -65
- package/src/components/business/charges-section.tsx +0 -82
- package/src/components/business/charts-section.tsx +0 -115
- package/src/components/business/configurations-section.tsx +0 -835
- package/src/components/business/contact-info-section.tsx +0 -544
- package/src/components/business/contracts-section.tsx +0 -195
- package/src/components/business/documents-section.tsx +0 -26
- package/src/components/business/index.tsx +0 -171
- package/src/components/business/integrations-section.tsx +0 -479
- package/src/components/business/transactions-section.tsx +0 -26
- package/src/components/clients/contracts/modify-contract-dialog.tsx +0 -466
- package/src/components/clients/modify-client-dialog.tsx +0 -276
- package/src/components/screens/businesses/business.tsx +0 -50
- package/src/components/ui/progress.tsx +0 -25
- package/src/components/ui/skeleton.tsx +0 -12
- package/src/helpers/contracts.ts +0 -22
- package/src/helpers/pcn874.ts +0 -17
- package/src/hooks/use-create-contract.ts +0 -62
- package/src/hooks/use-delete-contract.ts +0 -64
- package/src/hooks/use-insert-client.ts +0 -80
- package/src/hooks/use-update-client.ts +0 -75
- package/src/hooks/use-update-contract.ts +0 -69
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { toast } from 'sonner';
|
|
3
|
-
import { useMutation } from 'urql';
|
|
4
|
-
import {
|
|
5
|
-
UpdateContractDocument,
|
|
6
|
-
type UpdateContractMutation,
|
|
7
|
-
type UpdateContractMutationVariables,
|
|
8
|
-
} from '../gql/graphql.js';
|
|
9
|
-
import { handleCommonErrors } from '../helpers/error-handling.js';
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- used by codegen
|
|
12
|
-
/* GraphQL */ `
|
|
13
|
-
mutation UpdateContract($contractId: UUID!, $input: UpdateContractInput!) {
|
|
14
|
-
updateContract(contractId: $contractId, input: $input) {
|
|
15
|
-
id
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
type Contract = UpdateContractMutation['updateContract'];
|
|
21
|
-
|
|
22
|
-
type UseUpdateContract = {
|
|
23
|
-
updating: boolean;
|
|
24
|
-
updateContract: (variables: UpdateContractMutationVariables) => Promise<Contract | void>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const NOTIFICATION_ID = 'updateContract';
|
|
28
|
-
|
|
29
|
-
export const useUpdateContract = (): UseUpdateContract => {
|
|
30
|
-
// TODO: add authentication
|
|
31
|
-
// TODO: add local data update method after change
|
|
32
|
-
|
|
33
|
-
const [{ fetching }, mutate] = useMutation(UpdateContractDocument);
|
|
34
|
-
const updateContract = useCallback(
|
|
35
|
-
async (variables: UpdateContractMutationVariables) => {
|
|
36
|
-
const message = `Error updating contract ID [${variables.contractId}]`;
|
|
37
|
-
const notificationId = `${NOTIFICATION_ID}-${variables.contractId}`;
|
|
38
|
-
toast.loading('Updating contract', {
|
|
39
|
-
id: notificationId,
|
|
40
|
-
});
|
|
41
|
-
try {
|
|
42
|
-
const res = await mutate(variables);
|
|
43
|
-
const data = handleCommonErrors(res, message, notificationId, 'updateContract');
|
|
44
|
-
if (data) {
|
|
45
|
-
toast.success('Success', {
|
|
46
|
-
id: notificationId,
|
|
47
|
-
description: 'Contract updated',
|
|
48
|
-
});
|
|
49
|
-
return data.updateContract;
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.error(`${message}: ${e}`);
|
|
53
|
-
toast.error('Error', {
|
|
54
|
-
id: notificationId,
|
|
55
|
-
description: message,
|
|
56
|
-
duration: 100_000,
|
|
57
|
-
closeButton: true,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return void 0;
|
|
61
|
-
},
|
|
62
|
-
[mutate],
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
updating: fetching,
|
|
67
|
-
updateContract,
|
|
68
|
-
};
|
|
69
|
-
};
|