Skip to content

Commit

Permalink
Merge pull request #388 from significa/manpower-visibility
Browse files Browse the repository at this point in the history
allow to show or hide manpower in proposals
  • Loading branch information
nunopolonia authored May 29, 2024
2 parents 3c1e72c + 830759f commit 9534139
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 36 deletions.
36 changes: 23 additions & 13 deletions components.198185.json
Original file line number Diff line number Diff line change
Expand Up @@ -4954,7 +4954,7 @@
"name": "proposal-version",
"display_name": null,
"created_at": "2023-09-11T15:33:34.190Z",
"updated_at": "2024-01-26T11:12:54.014Z",
"updated_at": "2024-05-29T09:22:53.544Z",
"id": 4555208,
"schema": {
"version_name": {
Expand Down Expand Up @@ -5008,6 +5008,10 @@
"show_team_members": {
"type": "boolean",
"default_value": true
},
"show_manpower": {
"type": "boolean",
"default_value": true
}
},
"image": null,
Expand All @@ -5030,17 +5034,27 @@
"name": "proposal-version-package",
"display_name": null,
"created_at": "2023-12-28T13:15:17.211Z",
"updated_at": "2024-01-26T10:56:14.601Z",
"updated_at": "2024-05-29T09:49:07.190Z",
"id": 5094324,
"schema": {
"version_name": {
"type": "text",
"required": true,
"pos": 0
},
"show_team_members": {
"type": "boolean",
"default_value": true,
"pos": 1
},
"show_manpower": {
"type": "boolean",
"pos": 2,
"default_value": true
},
"discount_percentage": {
"type": "number",
"pos": 1,
"pos": 3,
"min_value": 0,
"max_value": 100,
"decimals": 0,
Expand All @@ -5050,48 +5064,44 @@
"type": "datetime",
"disable_time": true,
"required": true,
"pos": 2
"pos": 4
},
"deliverables": {
"type": "bloks",
"restrict_type": "",
"restrict_components": true,
"component_whitelist": ["proposal-deliverable"],
"required": false,
"pos": 3
"pos": 5
},
"pricing": {
"type": "bloks",
"restrict_type": "",
"restrict_components": true,
"component_whitelist": ["proposal-package-pricing"],
"required": false,
"pos": 4
"pos": 6
},
"team": {
"type": "bloks",
"required": false,
"restrict_type": "",
"restrict_components": true,
"component_whitelist": ["proposal-package-team-entry"],
"pos": 5
"pos": 7
},
"tab-4ab934ca-2771-464a-857a-ee27ae87c8d3": {
"display_name": "Content",
"keys": ["body"],
"pos": 6,
"pos": 8,
"type": "tab"
},
"body": {
"type": "bloks",
"restrict_type": "",
"restrict_components": true,
"component_whitelist": ["proposal-section"],
"pos": 7
},
"show_team_members": {
"type": "boolean",
"default_value": true
"pos": 9
}
},
"image": null,
Expand Down
49 changes: 28 additions & 21 deletions src/components/proposals/proposal-deliverables.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import type { ProposalDeliverableStoryblok } from '$types/bloks';
export let data: ProposalDeliverableStoryblok[];
export let showManpower = true;
$: totalManpower = data.reduce((acc, entry) => (acc += +entry.manpower), 0);
</script>
Expand All @@ -25,9 +26,11 @@
{t('proposals.scope.service')}
</p>

<p class="text-2xs uppercase text-foreground-secondary text-right">
{t('proposals.deliverables.manpower')}
</p>
{#if showManpower}
<p class="text-2xs uppercase text-foreground-secondary text-right">
{t('proposals.deliverables.manpower')}
</p>
{/if}
</div>
</div>

Expand Down Expand Up @@ -68,29 +71,33 @@
{/each}
</div>

<p class="my-4 text-sm text-right">
{entry.manpower}
{+entry.manpower > 1 ? t('proposals.months') : t('proposals.month')}
</p>
{#if showManpower}
<p class="my-4 text-sm text-right">
{entry.manpower}
{+entry.manpower > 1 ? t('proposals.months') : t('proposals.month')}
</p>
{/if}
</div>
</div>
{/each}
</div>

<div class="bg-background-offset/50 min-w-[780px]">
<div
class={clsx(
'md:container md:mx-auto px-container',
'flex gap-x-2 py-2 justify-end items-baseline font-semibold'
)}
>
<span class="font-normal text-2xs uppercase text-foreground-secondary"
>{t('proposals.deliverables.total')}</span
{#if showManpower}
<div class="bg-background-offset/50 min-w-[780px]">
<div
class={clsx(
'md:container md:mx-auto px-container',
'flex gap-x-2 py-2 justify-end items-baseline font-semibold'
)}
>
<span>
{totalManpower}
{totalManpower > 1 ? t('proposals.months') : t('proposals.month')}
</span>
<span class="font-normal text-2xs uppercase text-foreground-secondary"
>{t('proposals.deliverables.total')}</span
>
<span>
{totalManpower}
{totalManpower > 1 ? t('proposals.months') : t('proposals.month')}
</span>
</div>
</div>
</div>
{/if}
</div>
2 changes: 1 addition & 1 deletion src/components/proposals/proposal-page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{#if section.data === 'scope' && content?.scope}
<ProposalScope data={content.scope} />
{:else if type === 'package' && section.data === 'deliverables' && content?.deliverables}
<ProposalDeliverables data={content.deliverables} />
<ProposalDeliverables data={content.deliverables} showManpower={content.show_manpower} />
{:else if section.data === 'team' && content?.team}
<ProposalTeam data={content.team} {type} showTeamMembers={content.show_team_members} />
{:else if type === 'rate' && section.data === 'estimates' && content?.estimates && content?.team}
Expand Down
4 changes: 3 additions & 1 deletion src/types/bloks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,20 +1159,22 @@ export interface ProposalVersionStoryblok {
estimates: ProposalEstimateEntryStoryblok[];
body?: ProposalSectionStoryblok[];
show_team_members?: boolean;
show_manpower?: boolean;
_uid: string;
component: 'proposal-version';
[k: string]: any;
}

export interface ProposalVersionPackageStoryblok {
version_name: string;
show_team_members?: boolean;
show_manpower?: boolean;
discount_percentage?: string;
date: string;
deliverables?: ProposalDeliverableStoryblok[];
pricing?: ProposalPackagePricingStoryblok[];
team?: ProposalPackageTeamEntryStoryblok[];
body?: ProposalSectionStoryblok[];
show_team_members?: boolean;
_uid: string;
component: 'proposal-version-package';
[k: string]: any;
Expand Down

0 comments on commit 9534139

Please sign in to comment.