Skip to content

Commit

Permalink
Disable key result owner select on archive
Browse files Browse the repository at this point in the history
  • Loading branch information
petterhj committed Nov 13, 2023
1 parent 237abf9 commit 46e34ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/components/drawers/EditKeyResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
v-model="contributor"
name="owner"
input-type="select"
:disabled="thisKeyResult?.archived"
:select-options="ownerOptions"
:label="$t('fields.owner')"
rules="required"
Expand Down Expand Up @@ -89,28 +90,25 @@
</form-component>
</template>

<template
v-if="!thisKeyResult?.archived"
#actions="{ handleSubmit, submitDisabled }"
>
<template #actions="{ handleSubmit, submitDisabled }">
<pkt-button
v-if="pageIndex === 1"
:text="$t('btn.cancel')"
skin="tertiary"
:disabled="loading"
:disabled="loading || thisKeyResult?.archived"
@onClick="close"
/>
<pkt-button
v-else
:text="$t('btn.back')"
skin="tertiary"
:disabled="loading"
:disabled="loading || thisKeyResult?.archived"
@onClick="prev"
/>

<btn-save
:label="pageIndex === pageCount ? $t('btn.complete') : $t('btn.continue')"
:disabled="submitDisabled || loading"
:disabled="submitDisabled || loading || thisKeyResult?.archived"
variant="label-only"
@click="handleSubmit(save)"
/>
Expand Down Expand Up @@ -393,6 +391,7 @@ export default {
await this.syncObjectiveContributor();
this.thisKeyResult.archived = true;
this.$emit('archive', this.thisKeyResult);
this.$refs.drawer.reset();
} catch (error) {
this.$toasted.error(
this.$t('toaster.error.archive', { document: this.thisKeyResult.name })
Expand Down
2 changes: 1 addition & 1 deletion src/locale/locales/nb-NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
"new": "Nytt nøkkelresultat",
"created": "Nøkkelresultatet ble opprettet!",
"updated": "Nøkkelresultatet ble endret!",
"change": "Rediger Nøkkelresultat",
"change": "Rediger nøkkelresultat",
"delete": "Slett nøkkelresultat"
},
"measurement": {
Expand Down
19 changes: 19 additions & 0 deletions src/styles/_vSelect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
--vs-dropdown-option--active-color: var(--color-active);
--vs-dropdown-box-shadow: 0px 5px 30px -10px rgba(0, 0, 0, 0.2);
--vs-transition-duration: 100ms;
--vs-disabled-bg: var(--color-gray);
--vs-disabled-color: var(--color-grayscale-30);
--vs-disabled-border: var(--color-grayscale-30);
}

.vs__dropdown-toggle {
Expand Down Expand Up @@ -111,6 +114,22 @@
}
}

&.vs--disabled {
color: var(--color-grayscale-30);
background-color: var(--color-gray);
border-color: var(--color-grayscale-30);

.vs__selected {
color: var(--vs-disabled-color);
}
.vs__actions {
--fg-color: var(--vs-disabled-color);
}
.vs__dropdown-toggle {
border-color: var(--vs-disabled-border);
}
}

&:focus-within:not(.vs--open) {
outline: 2px solid var(--color-active);

Expand Down

0 comments on commit 46e34ed

Please sign in to comment.