Skip to content

Commit 336efde

Browse files
committed
Ny modal för att redigera förändringar i eget kapital
1 parent 1ba9a97 commit 336efde

19 files changed

+195
-105
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ main {
311311
/* För skuggan */
312312
padding: 0 0.5rem 0.5rem 0;
313313
314-
@media screen and (max-width: 1599px) {
314+
@media screen and (max-width: 1600px) {
315315
width: calc(210mm * 0.76);
316316
scale: 0.75;
317317
transform-origin: top left;

src/components/common/CommonModal.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ onMounted(() => {
7070
7171
.modal-body {
7272
display: flex;
73+
max-width: 98vw;
7374
max-height: 75vh;
7475
overflow-y: auto;
7576
padding-bottom: 2rem;
7677
}
78+
79+
h3 {
80+
font-size: 1.5rem;
81+
}
7782
</style>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script lang="ts" setup>
2+
/**
3+
* En generell komponent för modala fönsters underrubriker.
4+
*/
5+
</script>
6+
7+
<template>
8+
<h4>
9+
<slot />
10+
</h4>
11+
</template>
12+
13+
<style lang="scss" scoped>
14+
h4 {
15+
font-size: 1.25rem;
16+
}
17+
</style>

src/components/edit/EditNewArsredovisningModal.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ const orgnrRegex = /^\d{6}-?\d{4}$/;
147147
</p>
148148

149149
<p>
150-
Tänk på att kontrollera i efterhand att fälten blev korrekt ifyllda, och
151-
att själv fylla i de uppgifter som återstår (bland annat noter).
150+
Tänk på att kontrollera efteråt att fälten blev korrekt ifyllda, och att
151+
själv fylla i de uppgifter som återstår – oftast delar av
152+
förvaltningsberättelsen och noterna.
152153
</p>
153154

154155
<CommonFileInput

src/components/edit/blocks/belopprad/EditBeloppradString.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const trClasses = computed(() => [
5959
<template>
6060
<template v-if="multiline && !isAbstract">
6161
<tr :class="trClasses">
62-
<td :colspan="comparableNumPreviousYears + 2">
62+
<td :colspan="comparableNumPreviousYears + (allowDelete ? 2 : 1)">
6363
<BaseEditBeloppradTitle
6464
:belopprad="belopprad"
6565
:taxonomy-manager="taxonomyManager"

src/components/edit/sections/EditForvaltningsberattelse.vue

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import EditForvaltningsberattelseForandringar from "@/components/edit/sections/f
1313
import BaseEditBeloppradTitle from "@/components/edit/blocks/belopprad/BaseEditBeloppradTitle.vue";
1414
import { usePrepopulateSection } from "@/components/edit/composables/usePrepopulateSection.ts";
1515
import { TaxonomyRootName } from "@/model/taxonomy/TaxonomyItem.ts";
16+
import CommonModal from "@/components/common/CommonModal.vue";
17+
import { useTemplateRef } from "vue";
18+
import type { ComponentExposed } from "vue-component-type-helpers";
19+
import CommonWizardButtons from "@/components/common/CommonWizardButtons.vue";
1620
1721
// TaxonomyManager och rader
1822
const taxonomyManager = await getTaxonomyManager(
@@ -26,6 +30,10 @@ const arsredovisning = defineModel<Arsredovisning>("arsredovisning", {
2630
required: true,
2731
});
2832
33+
// Modal för förändringar i eget kapital
34+
const forandringarModal =
35+
useTemplateRef<ComponentExposed<typeof CommonModal>>("forandringarModal");
36+
2937
// Förpopulera rader
3038
const { prepopulateSection, groupPrepopulatedSection } = usePrepopulateSection({
3139
taxonomyManager,
@@ -74,16 +82,14 @@ const groupedBelopprader = groupPrepopulatedSection(belopprader, groups);
7482
"
7583
:taxonomy-manager="taxonomyManager"
7684
/>
77-
<EditForvaltningsberattelseForandringar
85+
<template
7886
v-else-if="group.xmlName === 'se-gen-base:ForandringEgetKapital'"
79-
:arsredovisning="arsredovisning"
80-
:group-taxonomy-item="
81-
availableTaxonomyItems.childrenFlat.find(
82-
(item) => item.xmlName === 'se-gen-base:ForandringEgetKapital',
83-
)!
84-
"
85-
:taxonomy-manager="taxonomyManager"
86-
/>
87+
>
88+
<!-- Vi har denna som en modal pga att den blir för bred annars -->
89+
<button class="btn btn-primary" @click="forandringarModal?.show()">
90+
Visa tabell
91+
</button>
92+
</template>
8793
<table v-else>
8894
<thead v-if="groupedBelopprader[groupIndex].length > 1">
8995
<tr>
@@ -112,6 +118,27 @@ const groupedBelopprader = groupPrepopulatedSection(belopprader, groups);
112118
</div>
113119
</div>
114120
</div>
121+
122+
<CommonModal
123+
id="edit-forvaltningsberattelse-forandringar-modal"
124+
ref="forandringarModal"
125+
title="Förändringar i eget kapital"
126+
>
127+
<EditForvaltningsberattelseForandringar
128+
:arsredovisning="arsredovisning"
129+
:group-taxonomy-item="
130+
availableTaxonomyItems.childrenFlat.find(
131+
(item) => item.xmlName === 'se-gen-base:ForandringEgetKapital',
132+
)!
133+
"
134+
:taxonomy-manager="taxonomyManager"
135+
/>
136+
<CommonWizardButtons
137+
next-button-text="Klar"
138+
previous-button-hidden
139+
@go-to-next-step="forandringarModal?.hide()"
140+
/>
141+
</CommonModal>
115142
</template>
116143

117144
<style lang="scss" scoped></style>

src/components/edit/sections/forvaltningsberattelse/EditForvaltningsberattelseForandringar.vue

Lines changed: 88 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@
77
import { TaxonomyManager } from "@/util/TaxonomyManager.ts";
88
import type { Arsredovisning } from "@/model/arsredovisning/Arsredovisning.ts";
99
import { computed } from "vue";
10-
import {
11-
createBelopprad,
12-
createBeloppradInList,
13-
deleteBelopprad,
14-
isBeloppradInTaxonomyItemList,
15-
} from "@/model/arsredovisning/Belopprad.ts";
16-
import BaseEditBeloppradDeleteButton from "@/components/edit/blocks/belopprad/BaseEditBeloppradDeleteButton.vue";
1710
import { getForandringarAsTable } from "@/util/forandringarUtils.ts";
18-
import BaseEditBeloppradTitle from "@/components/edit/blocks/belopprad/BaseEditBeloppradTitle.vue";
1911
import type { TaxonomyItem } from "@/model/taxonomy/TaxonomyItem.ts";
12+
import { usePrepopulateSection } from "@/components/edit/composables/usePrepopulateSection.ts";
2013
2114
const props = defineProps<{
2215
/** TaxonomyManager för att hantera taxonomiobjekt i förändringar i eget kapital. */
@@ -36,15 +29,15 @@ const groupTaxonomyItemFull = computed(() =>
3629
"se-gen-base:ForandringEgetKapitalAbstract",
3730
),
3831
);
32+
const { prepopulateSection } = usePrepopulateSection({
33+
taxonomyManager: props.taxonomyManager,
34+
availableTaxonomyItems: props.groupTaxonomyItem,
35+
arsredovisning: arsredovisning,
36+
sectionName: "forvaltningsberattelse",
37+
maxNumPreviousYears: 0,
38+
});
3939
40-
const belopprader = computed(() =>
41-
arsredovisning.value.forvaltningsberattelse.filter((belopprad) =>
42-
isBeloppradInTaxonomyItemList(
43-
groupTaxonomyItemFull.value.childrenFlat,
44-
belopprad,
45-
),
46-
),
47-
);
40+
const belopprader = prepopulateSection();
4841
4942
const forandringarTable = computed(() =>
5043
getForandringarAsTable(
@@ -53,31 +46,13 @@ const forandringarTable = computed(() =>
5346
belopprader.value,
5447
),
5548
);
56-
57-
const overgangK2AbstractItem = props.taxonomyManager.getItemByName(
58-
"se-gen-base:ForandringIngaendeEgetKapitalOvergangK2Abstract",
59-
);
60-
61-
// Hjälpfunktioner
62-
function addBelopprad(taxonomyItem: TaxonomyItem) {
63-
createBeloppradInList(
64-
props.taxonomyManager,
65-
arsredovisning.value.forvaltningsberattelse,
66-
taxonomyItem,
67-
);
68-
}
6949
</script>
7050

7151
<template>
72-
<table>
52+
<table class="edit-forandringar-table">
7353
<thead>
7454
<tr>
75-
<th scope="col">
76-
<BaseEditBeloppradTitle
77-
:belopprad="createBelopprad(groupTaxonomyItem)"
78-
:taxonomy-manager="taxonomyManager"
79-
/>
80-
</th>
55+
<th></th>
8156
<th
8257
v-for="columnName in forandringarTable.columnNames"
8358
:key="columnName"
@@ -91,11 +66,14 @@ function addBelopprad(taxonomyItem: TaxonomyItem) {
9166
<tbody>
9267
<tr v-for="(row, rowIndex) in forandringarTable.table" :key="rowIndex">
9368
<td>
94-
{{ forandringarTable.rowNames[rowIndex] }}
69+
<div class="row-label">
70+
{{ forandringarTable.rowNames[rowIndex] }}
71+
</div>
9572
</td>
9673
<td
9774
v-for="(cell, columnIndex) in row"
9875
:key="columnIndex"
76+
:class="{ 'empty-container': cell == null }"
9977
class="value-container"
10078
>
10179
<div v-if="cell != null" class="value-contents">
@@ -104,55 +82,92 @@ function addBelopprad(taxonomyItem: TaxonomyItem) {
10482
class="form-control"
10583
type="text"
10684
/>
107-
<BaseEditBeloppradDeleteButton
108-
@delete="
109-
() =>
110-
deleteBelopprad(
111-
taxonomyManager,
112-
cell.belopprad,
113-
arsredovisning.forvaltningsberattelse,
114-
)
115-
"
116-
/>
11785
</div>
11886
</td>
11987
</tr>
12088
</tbody>
12189
</table>
122-
123-
<!--
124-
Vi vill inte ha med "Specifikation av förändringar i ingående eget kapital vid övergång till K2",
125-
det är extremt osannolikt att någon kommer ha nytta av den numera så det skräpar bara ner.
126-
-->
127-
<EditItemSelector
128-
:taxonomy-items="[
129-
groupTaxonomyItemFull,
130-
...groupTaxonomyItemFull.childrenFlat.filter(
131-
(child) =>
132-
child.xmlName !== overgangK2AbstractItem.xmlName &&
133-
!overgangK2AbstractItem.childrenFlat.includes(child),
134-
),
135-
]"
136-
@add-belopprad="addBelopprad"
137-
/>
13890
</template>
13991

14092
<style lang="scss" scoped>
14193
@import "@/assets/extendables.scss";
14294
143-
.value-contents {
144-
display: flex;
95+
@mixin auto-font-sizes {
96+
@media (max-width: 1500px) {
97+
font-size: 0.7rem;
98+
}
99+
100+
@media (min-width: 1500px) and (max-width: 1700px) {
101+
font-size: 0.8rem;
102+
}
103+
104+
@media (min-width: 1700px) and (max-width: 1900px) {
105+
font-size: 0.9rem;
106+
}
107+
}
108+
109+
table.edit-forandringar-table {
110+
width: min-content;
111+
112+
border-collapse: separate;
113+
border-spacing: 0;
114+
115+
thead {
116+
position: sticky;
117+
top: -1rem;
118+
background: white;
119+
}
120+
121+
th,
122+
td {
123+
@include auto-font-sizes;
124+
125+
border: 1px solid lightgray;
126+
127+
&:not(:last-child) {
128+
border-right: none;
129+
}
130+
}
131+
132+
tr:not(:last-child) {
133+
td {
134+
border-bottom: none;
135+
}
136+
}
137+
138+
th {
139+
padding-left: 1rem;
140+
border-bottom-width: 4px;
141+
}
142+
143+
td {
144+
.row-label {
145+
width: max-content;
146+
}
147+
148+
&.value-container {
149+
&.empty-container {
150+
background: lightgray;
151+
}
152+
153+
.value-contents input {
154+
width: 100%;
155+
156+
&.form-control {
157+
@extend %text-input;
158+
@include auto-font-sizes;
145159
146-
input {
147-
flex: 1;
148-
margin-right: 0.25rem;
149-
min-width: 100px !important;
160+
@media (max-width: 1500px) {
161+
min-width: 80px;
162+
}
150163
151-
&.form-control {
152-
@extend %text-input;
164+
@media (min-width: 1500px) and (max-width: 1700px) {
165+
min-width: 100px;
166+
}
153167
154-
padding-left: 0.5rem;
155-
padding-right: 0.5rem;
168+
padding: 0.25rem 0.5rem;
169+
}
170+
}
156171
}
157172
}
158173
}

src/components/tools/finish/common/steps/CommonBolagsverketAgreement.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import CommonWizardButtons, {
1414
type CommonWizardButtonsEmits,
1515
} from "@/components/common/CommonWizardButtons.vue";
1616
import type { CommonStepProps } from "@/components/tools/finish/common/steps/CommonStepProps.ts";
17+
import CommonModalSubtitle from "@/components/common/CommonModalSubtitle.vue";
1718
1819
const props = defineProps<
1920
CommonStepProps & {
@@ -80,9 +81,9 @@ onMounted(() => {
8081

8182
<template>
8283
<div>
83-
<h4>
84+
<CommonModalSubtitle>
8485
Steg {{ currentStepNumber }}/{{ numSteps }}: Information från Bolagsverket
85-
</h4>
86+
</CommonModalSubtitle>
8687

8788
<div v-if="loading">Laddar…</div>
8889

src/components/tools/finish/common/steps/CommonValidateReport.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import CommonWizardButtons, {
1818
type CommonWizardButtonsEmits,
1919
} from "@/components/common/CommonWizardButtons.vue";
2020
import type { CommonStepProps } from "@/components/tools/finish/common/steps/CommonStepProps.ts";
21+
import CommonModalSubtitle from "@/components/common/CommonModalSubtitle.vue";
2122
2223
const props = defineProps<
2324
CommonStepProps & {
@@ -86,9 +87,9 @@ onMounted(() => {
8687

8788
<template>
8889
<div>
89-
<h4>
90+
<CommonModalSubtitle>
9091
Steg {{ currentStepNumber }}/{{ numSteps }}: Bolagsverkets kontroller
91-
</h4>
92+
</CommonModalSubtitle>
9293

9394
<div v-if="loading">Kontrollerar – det kan ta några sekunder…</div>
9495

0 commit comments

Comments
 (0)