@controleonline/ui-crm 1.0.42
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/.github/actions/workers/manager/action.yml +147 -0
- package/.github/actions/workers/qa/action.yml +44 -0
- package/.github/actions/workers/security/action.yml +44 -0
- package/.github/actions/workers/technical-documenter/action.yml +51 -0
- package/.github/workflows/manager-worker.yml +167 -0
- package/.github/workflows/publish-npm.yml +40 -0
- package/.github/workflows/pull-request-checks.yml +29 -0
- package/.scrutinizer.yml +24 -0
- package/AGENTS.md +56 -0
- package/FUNDING.yml +1 -0
- package/docs/technical/Cliente-Vendedor-Vinculo-e-Permissoes.md +121 -0
- package/docs/technical/Income-Statements-Demonstrativo.md +38 -0
- package/docs/technical/Oportunidades-Ordenacao-por-Data-de-Retorno.md +134 -0
- package/docs/technical/Propostas-Filtro-de-Status.md +147 -0
- package/docs/technical/Royalties-a-pagar-Franqueado.md +51 -0
- package/docs/technical/Visao-Vendedor-Comissoes.md +58 -0
- package/docs/wiki.md +1 -0
- package/package.json +43 -0
- package/scripts/validate-wiki-pointer.cjs +13 -0
- package/src/react/components/AnimatedModal.js +149 -0
- package/src/react/components/AnimatedModal.styles.js +21 -0
- package/src/react/components/CreateContractModal.js +151 -0
- package/src/react/components/CreateContractModal.styles.js +43 -0
- package/src/react/hooks/useToastMessage.js +59 -0
- package/src/react/index.js +4 -0
- package/src/react/pages/ModelTemplatesPage.js +1461 -0
- package/src/react/pages/ModelTemplatesPage.styles.js +441 -0
- package/src/react/pages/comissions/IncomeStatementDetailsModal.js +102 -0
- package/src/react/pages/comissions/IncomeStatementsFilters.js +120 -0
- package/src/react/pages/comissions/SellerCommissionsPage.js +368 -0
- package/src/react/pages/comissions/SellerCommissionsPage.styles.js +219 -0
- package/src/react/pages/comissions/incomeStatementsHelpers.js +233 -0
- package/src/react/pages/comissions/index.js +309 -0
- package/src/react/pages/comissions/index.styles.js +381 -0
- package/src/react/pages/comissions/sellerCommissionsHelpers.js +222 -0
- package/src/react/pages/crm/components/CrmHeader.js +117 -0
- package/src/react/pages/crm/components/MarketingEventsSection.js +142 -0
- package/src/react/pages/crm/components/MarketingEventsSection.styles.js +105 -0
- package/src/react/pages/crm/components/OpportunityCard.js +138 -0
- package/src/react/pages/crm/components/OpportunityFormModal.js +279 -0
- package/src/react/pages/crm/components/OpportunityList.js +113 -0
- package/src/react/pages/crm/components/OpportunitySkeletons.js +53 -0
- package/src/react/pages/crm/components/ProviderSelectModal.js +166 -0
- package/src/react/pages/crm/components/SelectModal.js +178 -0
- package/src/react/pages/crm/conversation.js +342 -0
- package/src/react/pages/crm/conversation.styles.js +206 -0
- package/src/react/pages/crm/hooks/useCrmData.js +494 -0
- package/src/react/pages/crm/hooks/useOpportunityForms.js +306 -0
- package/src/react/pages/crm/index.js +262 -0
- package/src/react/pages/crm/index.styles.js +13 -0
- package/src/react/pages/crm/marketingEventsHelpers.js +41 -0
- package/src/react/pages/crm/styles/card.styles.js +178 -0
- package/src/react/pages/crm/styles/layout.styles.js +184 -0
- package/src/react/pages/crm/styles/modal.styles.js +347 -0
- package/src/react/pages/home/index.js +559 -0
- package/src/react/pages/home/index.styles.js +268 -0
- package/src/react/pages/proposals/CreateProposalsModal.js +466 -0
- package/src/react/pages/proposals/CreateProposalsModal.styles.js +344 -0
- package/src/react/pages/proposals/CreateProposalsPickers.js +187 -0
- package/src/react/pages/proposals/CreateProposalsProductSection.js +117 -0
- package/src/react/pages/proposals/ProposalCard.js +112 -0
- package/src/react/pages/proposals/ProposalDetails.js +263 -0
- package/src/react/pages/proposals/ProposalDetails.styles.js +195 -0
- package/src/react/pages/proposals/index.js +488 -0
- package/src/react/pages/proposals/index.styles.js +248 -0
- package/src/react/pages/proposals/proposalListHelpers.js +216 -0
- package/src/react/pages/proposals/proposalNavigation.js +26 -0
- package/src/react/pages/royalties/ReceivablePage.js +233 -0
- package/src/react/pages/royalties/RoyaltiesPayablePage.js +260 -0
- package/src/react/pages/royalties/index.js +2 -0
- package/src/react/pages/royalties/royaltiesReceivableHelpers.js +68 -0
- package/src/react/pages/settings/GeneralSettings.js +317 -0
- package/src/react/pages/settings/GeneralSettings.shared.js +490 -0
- package/src/react/pages/settings/GeneralSettings.styles.js +746 -0
- package/src/react/pages/settings/GeneralSettingsSection.js +57 -0
- package/src/react/pages/settings/generalSettingsActiveTab.js +85 -0
- package/src/react/pages/settings/sections/CrmSection.js +281 -0
- package/src/react/pages/settings/sections/DeviceRuntimeFooterSection.js +128 -0
- package/src/react/pages/settings/sections/DisplayPreparationSection.js +155 -0
- package/src/react/pages/settings/sections/IntegrationsSection.js +392 -0
- package/src/react/pages/settings/sections/LogSection.js +322 -0
- package/src/react/pages/settings/sections/LoginSection.js +137 -0
- package/src/react/pages/settings/sections/LoyaltyProductPicker.js +230 -0
- package/src/react/pages/settings/sections/LoyaltySection.js +451 -0
- package/src/react/pages/settings/sections/MaintenanceSection.js +205 -0
- package/src/react/pages/settings/sections/MapsSection.js +629 -0
- package/src/react/pages/settings/sections/MenuCatalogSection.js +405 -0
- package/src/react/pages/settings/sections/OperationsSection.js +303 -0
- package/src/react/pages/settings/sections/OrderPaymentSection.js +379 -0
- package/src/react/pages/settings/sections/OrderPrintSection.js +308 -0
- package/src/react/pages/settings/sections/ShopSection.js +490 -0
- package/src/react/pages/settings/sections/shop/FranchiseMapPreview.js +124 -0
- package/src/react/pages/settings/sections/shop/ShopDomainCreateForm.js +57 -0
- package/src/react/pages/settings/sections/shop/ShopDomainPanel.js +184 -0
- package/src/react/pages/settings/sections/shop/ShopDomainShowcasesSection.js +237 -0
- package/src/react/pages/settings/sections/shop/ShopDomainShowcasesSection.styles.js +256 -0
- package/src/react/pages/settings/sections/shop/ShopDomainTabs.js +61 -0
- package/src/react/pages/settings/sections/shop/ShopFranchiseLocatorSection.js +526 -0
- package/src/react/pages/settings/sections/shop/ShopLoyaltySection.js +426 -0
- package/src/react/pages/settings/sections/shop/ShopSettingsSection.js +10 -0
- package/src/react/pages/settings/sections/shop/mapsFranchiseMapHelpers.js +163 -0
- package/src/react/pages/settings/sections/shop/shopDomainShowcasesUtils.js +68 -0
- package/src/react/pages/settings/sections/shop/shopFranchiseVisibility.js +158 -0
- package/src/react/pages/settings/sections/shop/shopSettingsShared.js +427 -0
- package/src/react/router/routes.js +135 -0
- package/src/react/utils/opportunityDate.js +82 -0
- package/src/react/utils/opportunityEditorReferences.js +76 -0
- package/src/react/utils/opportunityEmptyState.js +20 -0
- package/src/react/utils/opportunityPeople.js +111 -0
- package/src/react/utils/opportunityPhone.js +82 -0
- package/src/react/utils/opportunityStage.js +30 -0
- package/src/react/utils/opportunityStatusFilter.js +54 -0
- package/src/react/utils/proposalCreateHelpers.js +61 -0
- package/src/react/utils/proposalProductSelection.js +71 -0
- package/src/react/utils/royaltiesPayableParams.js +37 -0
- package/src/react/utils/translateWithFallback.js +42 -0
- package/src/store/crm/index.js +2 -0
- package/src/store/model/index.js +104 -0
- package/src/tests/browser/crm/create-proposal-product-category-filter.spec.js +149 -0
- package/src/tests/browser/crm/crm-index-status-filter.spec.js +263 -0
- package/src/tests/browser/crm/crm-opportunity-category-editor.spec.js +269 -0
- package/src/tests/browser/crm/royalties-payable.spec.js +122 -0
- package/src/tests/browser/crm/royalties-receivable.spec.js +121 -0
- package/src/tests/browser/crm/seller-commissions.spec.js +214 -0
- package/src/tests/browser/manager/general-settings-maps.spec.js +400 -0
- package/src/tests/react/pages/comissions/incomeStatementsHelpers.test.js +181 -0
- package/src/tests/react/pages/comissions/sellerCommissionsHelpers.test.js +132 -0
- package/src/tests/react/pages/crm/marketingEventsHelpers.test.cjs +53 -0
- package/src/tests/react/pages/crm/opportunitySearchParams.test.cjs +44 -0
- package/src/tests/react/pages/proposals/navigation.test.js +71 -0
- package/src/tests/react/pages/proposals/proposalListHelpers.test.js +42 -0
- package/src/tests/react/pages/royalties/royaltiesReceivableHelpers.test.js +60 -0
- package/src/tests/react/pages/settings/generalSettings.shared.test.js +102 -0
- package/src/tests/react/pages/settings/sections/shop/shopDomainShowcasesUtils.test.js +60 -0
- package/src/tests/react/pages/settings/sections/shop/shopFranchiseVisibility.test.js +80 -0
- package/src/tests/react/utils/opportunityEditorReferences.test.js +70 -0
- package/src/tests/react/utils/opportunityEmptyState.test.js +39 -0
- package/src/tests/react/utils/opportunityStatusFilter.test.cjs +81 -0
- package/src/tests/react/utils/proposalCreateHelpers.test.js +25 -0
- package/src/tests/react/utils/proposalProductSelection.test.js +76 -0
- package/src/tests/react/utils/royaltiesPayableParams.test.js +44 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
4
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
|
|
5
|
+
import Formatter from '@controleonline/ui-common/src/utils/formatter';
|
|
6
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
7
|
+
import styles from './index.styles';
|
|
8
|
+
import { buildProposalProductsParams, buildProposalDetailsParams } from './proposalNavigation';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Card for a single proposal in the list.
|
|
12
|
+
* Exposes an explicit "Produtos" action so users know where to associate products/services.
|
|
13
|
+
*/
|
|
14
|
+
const ProposalCard = ({
|
|
15
|
+
contract,
|
|
16
|
+
navigation,
|
|
17
|
+
getStatusColor,
|
|
18
|
+
getStatusLabel,
|
|
19
|
+
getContractClientName,
|
|
20
|
+
isContractClientPendingResolution,
|
|
21
|
+
}) => {
|
|
22
|
+
const clientName = getContractClientName(contract);
|
|
23
|
+
const isPendingClient = isContractClientPendingResolution(contract);
|
|
24
|
+
const clientLabel = clientName
|
|
25
|
+
? clientName
|
|
26
|
+
: isPendingClient
|
|
27
|
+
? global.t?.t('contract', 'label', 'loadingClient')
|
|
28
|
+
: global.t?.t('contract', 'label', 'clientNotInformed');
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View style={styles.card}>
|
|
32
|
+
<View style={styles.cardHeader}>
|
|
33
|
+
<View style={styles.headerContent}>
|
|
34
|
+
<Text style={styles.cardTitle}>
|
|
35
|
+
{contract.contractModel?.model || global.t?.t('contract', 'label', 'untitled')}
|
|
36
|
+
</Text>
|
|
37
|
+
<View
|
|
38
|
+
style={[
|
|
39
|
+
styles.statusBadge,
|
|
40
|
+
{ backgroundColor: getStatusColor(contract.status?.status) },
|
|
41
|
+
]}>
|
|
42
|
+
<Text style={styles.statusText}>{getStatusLabel(contract.status?.status)}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
</View>
|
|
45
|
+
</View>
|
|
46
|
+
|
|
47
|
+
<View style={styles.cardBody}>
|
|
48
|
+
<View style={styles.clientRow}>
|
|
49
|
+
<MaterialIcon name="person" size={14} color="#64748B" />
|
|
50
|
+
<Text style={styles.clientText}>
|
|
51
|
+
{global.t?.t('contract', 'label', 'client')}: {clientLabel}
|
|
52
|
+
</Text>
|
|
53
|
+
</View>
|
|
54
|
+
|
|
55
|
+
<View style={styles.datesContainer}>
|
|
56
|
+
<View style={styles.dateBadge}>
|
|
57
|
+
<MaterialIcon name="event" size={14} color="#64748B" />
|
|
58
|
+
<Text style={styles.dateText}>
|
|
59
|
+
{global.t?.t('contract', 'label', 'startDate')}:{' '}
|
|
60
|
+
{contract.startDate
|
|
61
|
+
? Formatter.formatDateYmdTodmY(contract.startDate)
|
|
62
|
+
: global.t?.t('contract', 'label', 'na')}
|
|
63
|
+
</Text>
|
|
64
|
+
</View>
|
|
65
|
+
{contract.endDate && (
|
|
66
|
+
<View style={styles.dateBadge}>
|
|
67
|
+
<MaterialIcon name="event-available" size={14} color="#64748B" />
|
|
68
|
+
<Text style={styles.dateText}>
|
|
69
|
+
{global.t?.t('contract', 'label', 'endDate')}:{' '}
|
|
70
|
+
{Formatter.formatDateYmdTodmY(contract.endDate)}
|
|
71
|
+
</Text>
|
|
72
|
+
</View>
|
|
73
|
+
)}
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
|
|
77
|
+
<View style={styles.cardFooter}>
|
|
78
|
+
<View style={styles.footerActions}>
|
|
79
|
+
<TouchableOpacity
|
|
80
|
+
style={styles.footerButton}
|
|
81
|
+
onPress={() =>
|
|
82
|
+
navigation.navigate(
|
|
83
|
+
'ProposalDetails',
|
|
84
|
+
buildProposalProductsParams(contract.id),
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
activeOpacity={0.85}>
|
|
88
|
+
<MaterialIcon name="inventory-2" size={16} color="#64748B" />
|
|
89
|
+
<Text style={styles.footerButtonText}>Produtos</Text>
|
|
90
|
+
</TouchableOpacity>
|
|
91
|
+
|
|
92
|
+
<TouchableOpacity
|
|
93
|
+
style={[styles.footerButton, styles.footerButtonPrimary]}
|
|
94
|
+
onPress={() =>
|
|
95
|
+
navigation.navigate(
|
|
96
|
+
'ProposalDetails',
|
|
97
|
+
buildProposalDetailsParams(contract.id),
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
activeOpacity={0.85}>
|
|
101
|
+
<Text style={[styles.viewDetailsText, styles.footerButtonTextPrimary]}>
|
|
102
|
+
{global.t?.t('contract', 'action', 'viewDetails')}
|
|
103
|
+
</Text>
|
|
104
|
+
<Icon name="chevron-right" size={12} color={colors.primary} />
|
|
105
|
+
</TouchableOpacity>
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default ProposalCard;
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import React, { useEffect, useState, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
import { Text, View, TouchableOpacity, ScrollView, Dimensions, ActivityIndicator, Platform } from 'react-native';
|
|
3
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
5
|
+
import { useStores } from '@store';
|
|
6
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
7
|
+
import RenderHTML from 'react-native-render-html';
|
|
8
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
9
|
+
import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
|
|
10
|
+
import LinkedOrderProductsTab from '@controleonline/ui-common/src/react/components/LinkedOrderProductsTab';
|
|
11
|
+
import styles from './ProposalDetails.styles';
|
|
12
|
+
import { getProposalInitialTabIndex } from './proposalNavigation';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
inlineStyle_17_10,
|
|
16
|
+
inlineStyle_159_14,
|
|
17
|
+
inlineStyle_219_14,
|
|
18
|
+
inlineStyle_229_14,
|
|
19
|
+
} from './ProposalDetails.styles';
|
|
20
|
+
|
|
21
|
+
import { inlineStyle_27_8, inlineStyle_47_16 } from './ProposalDetails.styles';
|
|
22
|
+
const { width } = Dimensions.get('window');
|
|
23
|
+
|
|
24
|
+
const PropostaTab = ({ contract, fileContent, fileLoading, fileError, canEdit, handleSendPropostal }) => {
|
|
25
|
+
return (
|
|
26
|
+
<View style={inlineStyle_17_10}>
|
|
27
|
+
<ScrollView
|
|
28
|
+
style={styles.tabScroll}
|
|
29
|
+
contentContainerStyle={inlineStyle_27_8({
|
|
30
|
+
canEdit: canEdit,
|
|
31
|
+
})}>
|
|
32
|
+
<View style={styles.section}>
|
|
33
|
+
<Text style={styles.sectionTitle}>Proposta</Text>
|
|
34
|
+
|
|
35
|
+
{fileLoading ? (
|
|
36
|
+
<View style={styles.centerContainer}>
|
|
37
|
+
<ActivityIndicator size="large" color={colors.primary} />
|
|
38
|
+
<Text style={styles.loadingText}>Carregando proposta...</Text>
|
|
39
|
+
</View>
|
|
40
|
+
) : fileError ? (
|
|
41
|
+
<Text style={styles.errorText}>{fileError}</Text>
|
|
42
|
+
) : fileContent ? (
|
|
43
|
+
<View style={styles.htmlWrapper}>
|
|
44
|
+
<RenderHTML
|
|
45
|
+
contentWidth={width - 32}
|
|
46
|
+
source={{ html: fileContent }}
|
|
47
|
+
ignoredDomTags={['meta', 'title']}
|
|
48
|
+
baseStyle={inlineStyle_47_16}
|
|
49
|
+
/>
|
|
50
|
+
</View>
|
|
51
|
+
) : (
|
|
52
|
+
<View style={styles.centerContainer}>
|
|
53
|
+
<ActivityIndicator size="large" color={colors.primary} />
|
|
54
|
+
<Text style={styles.loadingText}>Gerando proposta...</Text>
|
|
55
|
+
</View>
|
|
56
|
+
)}
|
|
57
|
+
</View>
|
|
58
|
+
</ScrollView>
|
|
59
|
+
{canEdit && (
|
|
60
|
+
<View style={styles.fixedSignButtonContainer}>
|
|
61
|
+
<TouchableOpacity style={styles.signButton} onPress={handleSendPropostal}>
|
|
62
|
+
<Icon name="edit" size={20} color="#fff" />
|
|
63
|
+
<Text style={styles.signButtonText}>Enviar Proposta</Text>
|
|
64
|
+
</TouchableOpacity>
|
|
65
|
+
</View>
|
|
66
|
+
)}
|
|
67
|
+
</View>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const ProposalDetails = () => {
|
|
72
|
+
const navigation = useNavigation();
|
|
73
|
+
const route = useRoute();
|
|
74
|
+
const { contractId, initialTab } = route.params;
|
|
75
|
+
|
|
76
|
+
const { showSuccess, showError } = useMessage();
|
|
77
|
+
|
|
78
|
+
const contractStore = useStores((s) => s.contract);
|
|
79
|
+
|
|
80
|
+
const { item: contract, isLoading } = contractStore.getters;
|
|
81
|
+
const contractActions = contractStore.actions;
|
|
82
|
+
|
|
83
|
+
const [fileContent, setFileContent] = useState('');
|
|
84
|
+
const [fileLoading, setFileLoading] = useState(false);
|
|
85
|
+
const [fileError, setFileError] = useState(null);
|
|
86
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
87
|
+
|
|
88
|
+
const scrollRef = useRef(null);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const targetTabIndex = getProposalInitialTabIndex(initialTab);
|
|
92
|
+
if (targetTabIndex === 1) {
|
|
93
|
+
setActiveTab(targetTabIndex);
|
|
94
|
+
requestAnimationFrame(() => {
|
|
95
|
+
scrollRef.current?.scrollTo({ x: targetTabIndex * width, animated: false });
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, [initialTab]);
|
|
99
|
+
|
|
100
|
+
const canEdit = contract?.status?.realStatus === 'open';
|
|
101
|
+
const proposalTitle =
|
|
102
|
+
global.t?.t('contract', 'title', 'proposal') || 'Proposta';
|
|
103
|
+
|
|
104
|
+
useLayoutEffect(() => {
|
|
105
|
+
navigation.setOptions({
|
|
106
|
+
headerShown: true,
|
|
107
|
+
headerBackVisible: true,
|
|
108
|
+
title: proposalTitle,
|
|
109
|
+
});
|
|
110
|
+
}, [navigation, proposalTitle]);
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const loadData = async () => {
|
|
114
|
+
let data = await contractActions.get(contractId);
|
|
115
|
+
|
|
116
|
+
if (!data?.contractFile) {
|
|
117
|
+
try {
|
|
118
|
+
await contractActions.generate({ id: contractId });
|
|
119
|
+
data = await contractActions.get(contractId);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.log('Erro ao gerar proposta', e);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (data?.contractFile) {
|
|
126
|
+
setFileLoading(true);
|
|
127
|
+
try {
|
|
128
|
+
const res = await contractActions.getFileContent(data.contractFile['@id']);
|
|
129
|
+
setFileContent(res.content || '');
|
|
130
|
+
} catch {
|
|
131
|
+
setFileError('Falha ao carregar a proposta');
|
|
132
|
+
} finally {
|
|
133
|
+
setFileLoading(false);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
loadData();
|
|
139
|
+
|
|
140
|
+
}, [contractId]);
|
|
141
|
+
|
|
142
|
+
const handleSendPropostal = async () => {
|
|
143
|
+
try {
|
|
144
|
+
console.log('Implementar lógica de envio');
|
|
145
|
+
showSuccess('Proposta enviada com sucesso');
|
|
146
|
+
|
|
147
|
+
const updated = await contractActions.get(contractId);
|
|
148
|
+
if (updated?.contractFile) {
|
|
149
|
+
const res = await contractActions.getFileContent(updated.contractFile['@id']);
|
|
150
|
+
setFileContent(res.content || '');
|
|
151
|
+
}
|
|
152
|
+
} catch {
|
|
153
|
+
showError('Erro ao enviar proposta');
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const handleTabPress = (index) => {
|
|
158
|
+
setActiveTab(index);
|
|
159
|
+
scrollRef.current?.scrollTo({ x: index * width, animated: true });
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
if (isLoading || !contract) {
|
|
163
|
+
return (
|
|
164
|
+
<SafeAreaView style={styles.container}>
|
|
165
|
+
<View style={styles.topSkeleton} />
|
|
166
|
+
<View style={styles.infoSkeleton} />
|
|
167
|
+
<View style={styles.tabsSkeleton} />
|
|
168
|
+
</SafeAreaView>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<SafeAreaView style={styles.container}>
|
|
174
|
+
<View style={styles.topHeader}>
|
|
175
|
+
<View style={styles.topAvatar}>
|
|
176
|
+
<Icon name="description" size={32} color="#fff" />
|
|
177
|
+
</View>
|
|
178
|
+
<View style={inlineStyle_159_14}>
|
|
179
|
+
<Text style={styles.topTitle} numberOfLines={1}>
|
|
180
|
+
{contract.contractModel?.model || 'Proposta sem modelo'}
|
|
181
|
+
</Text>
|
|
182
|
+
<Text style={styles.topSubtitle}>ID: {contract.id}</Text>
|
|
183
|
+
</View>
|
|
184
|
+
</View>
|
|
185
|
+
<View style={styles.fixedInfo}>
|
|
186
|
+
<View
|
|
187
|
+
style={[
|
|
188
|
+
styles.statusBox,
|
|
189
|
+
{
|
|
190
|
+
backgroundColor: `${contract.status?.color}20`,
|
|
191
|
+
borderColor: contract.status?.color,
|
|
192
|
+
},
|
|
193
|
+
]}>
|
|
194
|
+
<Text style={[styles.statusText, { color: contract.status?.color }]}>
|
|
195
|
+
{contract.status?.status?.toUpperCase() || '—'}
|
|
196
|
+
</Text>
|
|
197
|
+
</View>
|
|
198
|
+
|
|
199
|
+
<View style={styles.datesRow}>
|
|
200
|
+
<View style={styles.dateBlock}>
|
|
201
|
+
<Text style={styles.dateLabel}>Início</Text>
|
|
202
|
+
<Text style={styles.dateValue}>
|
|
203
|
+
{contract.startDate ? new Date(contract.startDate).toLocaleDateString('pt-BR') : '—'}
|
|
204
|
+
</Text>
|
|
205
|
+
</View>
|
|
206
|
+
<View style={styles.dateBlock}>
|
|
207
|
+
<Text style={styles.dateLabel}>Término</Text>
|
|
208
|
+
<Text style={styles.dateValue}>
|
|
209
|
+
{contract.endDate ? new Date(contract.endDate).toLocaleDateString('pt-BR') : '—'}
|
|
210
|
+
</Text>
|
|
211
|
+
</View>
|
|
212
|
+
</View>
|
|
213
|
+
</View>
|
|
214
|
+
<View style={styles.tabs}>
|
|
215
|
+
<TouchableOpacity
|
|
216
|
+
style={[styles.tabItem, activeTab === 0 && styles.tabActive]}
|
|
217
|
+
onPress={() => handleTabPress(0)}>
|
|
218
|
+
<Text style={[styles.tabLabel, activeTab === 0 && styles.tabLabelActive]}>Proposta</Text>
|
|
219
|
+
</TouchableOpacity>
|
|
220
|
+
<TouchableOpacity
|
|
221
|
+
style={[styles.tabItem, activeTab === 1 && styles.tabActive]}
|
|
222
|
+
onPress={() => handleTabPress(1)}>
|
|
223
|
+
<Text style={[styles.tabLabel, activeTab === 1 && styles.tabLabelActive]}>Produtos</Text>
|
|
224
|
+
</TouchableOpacity>
|
|
225
|
+
</View>
|
|
226
|
+
<ScrollView
|
|
227
|
+
ref={scrollRef}
|
|
228
|
+
horizontal
|
|
229
|
+
pagingEnabled
|
|
230
|
+
showsHorizontalScrollIndicator={false}
|
|
231
|
+
onScroll={(e) => {
|
|
232
|
+
const idx = Math.round(e.nativeEvent.contentOffset.x / width);
|
|
233
|
+
if (idx !== activeTab) setActiveTab(idx);
|
|
234
|
+
}}>
|
|
235
|
+
<View style={inlineStyle_219_14({
|
|
236
|
+
width: width,
|
|
237
|
+
})}>
|
|
238
|
+
<PropostaTab
|
|
239
|
+
contract={contract}
|
|
240
|
+
fileContent={fileContent}
|
|
241
|
+
fileLoading={fileLoading}
|
|
242
|
+
fileError={fileError}
|
|
243
|
+
canEdit={canEdit}
|
|
244
|
+
handleSendPropostal={handleSendPropostal}
|
|
245
|
+
/>
|
|
246
|
+
</View>
|
|
247
|
+
<View style={inlineStyle_229_14({
|
|
248
|
+
width: width,
|
|
249
|
+
})}>
|
|
250
|
+
<LinkedOrderProductsTab
|
|
251
|
+
contract={contract}
|
|
252
|
+
canEdit={canEdit}
|
|
253
|
+
emptyTitle="Nenhum produto vinculado a esta proposta."
|
|
254
|
+
emptySubtitle="Adicione os produtos negociados para poder ajustar a proposta ao longo da conversa com o cliente."
|
|
255
|
+
searchPlaceholder="Buscar produto para adicionar a proposta..."
|
|
256
|
+
/>
|
|
257
|
+
</View>
|
|
258
|
+
</ScrollView>
|
|
259
|
+
</SafeAreaView>
|
|
260
|
+
);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export default ProposalDetails;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
2
|
+
import { colors } from '@controleonline/../../src/styles/colors';
|
|
3
|
+
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
container: { flex: 1, backgroundColor: '#f8fafc' },
|
|
6
|
+
|
|
7
|
+
topHeader: {
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
padding: 16,
|
|
11
|
+
paddingTop: Platform.OS === 'ios' ? 50 : 16,
|
|
12
|
+
backgroundColor: '#fff',
|
|
13
|
+
borderBottomWidth: 1,
|
|
14
|
+
borderBottomColor: '#e2e8f0',
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
topAvatar: {
|
|
18
|
+
width: 60,
|
|
19
|
+
height: 60,
|
|
20
|
+
borderRadius: 30,
|
|
21
|
+
backgroundColor: colors.primary,
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
marginRight: 16,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
topTitle: {
|
|
28
|
+
fontSize: 22,
|
|
29
|
+
fontWeight: 'bold',
|
|
30
|
+
color: '#0f172a',
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
topSubtitle: {
|
|
34
|
+
fontSize: 14,
|
|
35
|
+
color: '#64748b',
|
|
36
|
+
marginTop: 4,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
fixedInfo: {
|
|
40
|
+
backgroundColor: '#fff',
|
|
41
|
+
padding: 16,
|
|
42
|
+
borderBottomWidth: 1,
|
|
43
|
+
borderBottomColor: '#e2e8f0',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
statusBox: {
|
|
47
|
+
alignSelf: 'center',
|
|
48
|
+
paddingHorizontal: 24,
|
|
49
|
+
paddingVertical: 10,
|
|
50
|
+
borderRadius: 30,
|
|
51
|
+
borderWidth: 1.5,
|
|
52
|
+
marginBottom: 16,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
statusText: {
|
|
56
|
+
fontSize: 17,
|
|
57
|
+
fontWeight: '800',
|
|
58
|
+
textTransform: 'uppercase',
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
datesRow: {
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
justifyContent: 'space-between',
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
dateBlock: {
|
|
67
|
+
flex: 1,
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
paddingVertical: 10,
|
|
70
|
+
backgroundColor: '#f1f5f9',
|
|
71
|
+
borderRadius: 10,
|
|
72
|
+
marginHorizontal: 6,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
dateLabel: { fontSize: 12, color: '#64748b', marginBottom: 4 },
|
|
76
|
+
dateValue: { fontSize: 16, fontWeight: '700', color: '#0f172a' },
|
|
77
|
+
|
|
78
|
+
tabs: {
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
backgroundColor: '#fff',
|
|
81
|
+
borderBottomWidth: 1,
|
|
82
|
+
borderBottomColor: '#e2e8f0',
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
tabItem: { flex: 1, paddingVertical: 16, alignItems: 'center' },
|
|
86
|
+
|
|
87
|
+
tabActive: { borderBottomWidth: 3, borderBottomColor: colors.primary },
|
|
88
|
+
|
|
89
|
+
tabLabel: { fontSize: 15, fontWeight: '600', color: '#64748b' },
|
|
90
|
+
|
|
91
|
+
tabLabelActive: { color: colors.primary, fontWeight: '700' },
|
|
92
|
+
|
|
93
|
+
tabScroll: { flex: 1 },
|
|
94
|
+
|
|
95
|
+
section: {
|
|
96
|
+
backgroundColor: '#fff',
|
|
97
|
+
borderRadius: 12,
|
|
98
|
+
padding: 16,
|
|
99
|
+
elevation: 1,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
sectionTitle: { fontSize: 18, fontWeight: '700', marginBottom: 16 },
|
|
103
|
+
|
|
104
|
+
centerContainer: { alignItems: 'center', paddingVertical: 60 },
|
|
105
|
+
|
|
106
|
+
loadingText: { marginTop: 16, color: '#64748b', fontSize: 15 },
|
|
107
|
+
|
|
108
|
+
errorText: { color: colors.error, textAlign: 'center', padding: 24 },
|
|
109
|
+
|
|
110
|
+
htmlWrapper: { backgroundColor: '#fff' },
|
|
111
|
+
|
|
112
|
+
fixedSignButtonContainer: {
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
bottom: 0,
|
|
115
|
+
left: 0,
|
|
116
|
+
right: 0,
|
|
117
|
+
backgroundColor: '#fff',
|
|
118
|
+
padding: 16,
|
|
119
|
+
paddingBottom: Platform.OS === 'ios' ? 34 : 16,
|
|
120
|
+
borderTopWidth: 1,
|
|
121
|
+
borderTopColor: '#e2e8f0',
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
signButton: {
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
backgroundColor: colors.primary,
|
|
129
|
+
paddingVertical: 16,
|
|
130
|
+
borderRadius: 12,
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
signButtonText: { color: '#fff', fontSize: 16, fontWeight: '700', marginLeft: 12 },
|
|
134
|
+
|
|
135
|
+
topSkeleton: { height: 100, backgroundColor: '#e2e8f0', margin: 16, borderRadius: 12 },
|
|
136
|
+
|
|
137
|
+
infoSkeleton: {
|
|
138
|
+
height: 140,
|
|
139
|
+
backgroundColor: '#e2e8f0',
|
|
140
|
+
marginHorizontal: 16,
|
|
141
|
+
marginBottom: 8,
|
|
142
|
+
borderRadius: 12,
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
tabsSkeleton: {
|
|
146
|
+
height: 56,
|
|
147
|
+
backgroundColor: '#e2e8f0',
|
|
148
|
+
marginHorizontal: 16,
|
|
149
|
+
borderRadius: 12,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export default styles;
|
|
154
|
+
|
|
155
|
+
export const inlineStyle_17_10 = {
|
|
156
|
+
flex: 1,
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const inlineStyle_159_14 = {
|
|
160
|
+
flex: 1,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const inlineStyle_219_14 = (
|
|
164
|
+
{
|
|
165
|
+
width: width,
|
|
166
|
+
},
|
|
167
|
+
) => ({
|
|
168
|
+
width,
|
|
169
|
+
flex: 1,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const inlineStyle_229_14 = (
|
|
173
|
+
{
|
|
174
|
+
width: width,
|
|
175
|
+
},
|
|
176
|
+
) => ({
|
|
177
|
+
width,
|
|
178
|
+
flex: 1,
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export const inlineStyle_27_8 = (
|
|
182
|
+
{
|
|
183
|
+
canEdit: canEdit,
|
|
184
|
+
},
|
|
185
|
+
) => ({
|
|
186
|
+
padding: 16,
|
|
187
|
+
paddingBottom: canEdit ? 120 : 40,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
export const inlineStyle_47_16 = {
|
|
191
|
+
color: '#334155',
|
|
192
|
+
lineHeight: 24,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
|