Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Legislation Parameters Explorer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Legislation Parameters Explorer
Commits
3027da01
Commit
3027da01
authored
9 months ago
by
Emmanuel Raviart
Browse files
Options
Downloads
Patches
Plain Diff
Fix tax scales edition
parent
2b94c422
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/editor/src/lib/components/parameters/ScaleEdit.svelte
+36
-43
36 additions, 43 deletions
...ges/editor/src/lib/components/parameters/ScaleEdit.svelte
with
36 additions
and
43 deletions
packages/editor/src/lib/components/parameters/ScaleEdit.svelte
+
36
−
43
View file @
3027da01
...
...
@@ -8,6 +8,7 @@
isAmountScaleParameter
,
isRateScaleParameter
,
ScaleType
,
type
BracketAtInstant
,
type
LinearAverageRateScaleParameter
,
type
MarginalAmountScaleParameter
,
type
MarginalRateScaleParameter
,
...
...
@@ -51,23 +52,15 @@
let
{
data
}
=
$derived
(
$page
)
let
isAmountScale
=
$derived
(
isAmountScaleParameter
(
parameter
))
let
{
unitByName
,
units
}
=
$derived
(
data
)
function
addInstantReferencesAndScale
()
{
const
newScaleAtInstant
=
instantReferencesAndScaleArray
.
length
===
0
?
[
isAmountScale
?
{
amount
:
{
value
:
null
},
threshold
:
{
value
:
null
}
}
:
{
base
:
{
value
:
null
},
rate
:
{
value
:
null
},
threshold
:
{
value
:
null
},
},
]
:
structuredClone
(
instantReferencesAndScaleArray
[
0
][
1
])
?
[{}
as
BracketAtInstant
]
:
structuredClone
(
$state
.
snapshot
(
instantReferencesAndScaleArray
[
0
].
scaleAtInstant
),
)
instantReferencesAndScaleArray
=
[
{
instant
:
new
Date
().
toISOString
().
split
(
"
T
"
)[
0
],
...
...
@@ -287,19 +280,18 @@
<div
class=
"mb-2 mt-4 flex-col"
>
{
#if
isAmountScaleParameter
(
parameter
)
}
{
#if
(
parameter
as
MarginalAmountScaleParameter
|
SingleAmountScaleParameter
).
amount_unit
!==
undefined
}
{
@
const
amountScaleParameter
=
parameter
as
|
MarginalAmountScaleParameter
|
SingleAmountScaleParameter
}
{
#if
amountScaleParameter
.
amount_unit
!==
undefined
}
<label
class=
"flex text-base"
>
Unité de montant
&nbps;
:
<select
class=
"border-1 mx-auto ml-1 flex rounded p-1 text-sm"
required=
{
showErrors
}
bind:value=
{
(
parameter
as
|
MarginalAmountScaleParameter
|
SingleAmountScaleParameter
).
amount_unit
}
bind:value=
{
amountScaleParameter
.
amount_unit
}
>
{
#if
(
parameter
as
MarginalAmountScaleParameter
|
SingleAmountScaleParameter
)
.
amount_unit
===
undefined
}
{
#if
amountScaleParameter
.
amount_unit
===
undefined
}
<option
selected
value=
{
undefined
}
>
Non précisée
</option>
{
/if
}
{
#each
units
as
unit
}
...
...
@@ -313,19 +305,19 @@
{
/if
}
</label>
{
/if
}
{
:else
if
(
parameter
as
LinearAverageRateScaleParameter
|
MarginalRateScaleParameter
).
rate_unit
!==
undefined
}
{
:
else
}
{
@
const
rateScaleParameter
=
parameter
as
|
LinearAverageRateScaleParameter
|
MarginalRateScaleParameter
}
{
#if
rateScaleParameter
.
rate_unit
!==
undefined
}
<label
class=
"flex text-base"
>
Unité de taux
:
<select
class=
"border-1 mx-auto ml-1 flex rounded p-1 text-sm"
required=
{
showErrors
}
bind:value=
{
(
parameter
as
|
LinearAverageRateScaleParameter
|
MarginalRateScaleParameter
).
rate_unit
}
bind:value=
{
rateScaleParameter
.
rate_unit
}
>
{
#if
(
parameter
as
LinearAverageRateScaleParameter
|
MarginalRateScaleParameter
)
.
rate_unit
===
undefined
}
{
#if
rateScaleParameter
.
rate_unit
===
undefined
}
<option
selected
value=
{
undefined
}
>
Non précisée
</option>
{
/if
}
{
#each
units
as
unit
}
...
...
@@ -339,6 +331,7 @@
{
/if
}
</label>
{
/if
}
{
/if
}
<div
class=
"mb-2 flex"
>
<label
class=
"flex text-base"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment