|
16 | 16 | import TooltipHelper from "@dv-admin/components/ui/tooltipHelper/TooltipHelper.vue";
|
17 | 17 | import { computed, ref } from "vue";
|
18 | 18 | import { useI18n } from "vue-i18n";
|
19 |
| - import { putApiCurrenciesProject } from "@dv-admin/services/api/projects.ts"; |
| 19 | + import { postApiStoreSetting, putApiCurrenciesProject } from "@dv-admin/services/api/projects.ts"; |
20 | 20 | import { useGeneralStore } from "@dv-admin/stores/general";
|
21 | 21 | import { UiForm } from "@dv.net/ui-kit";
|
22 | 22 | import type { UiFormRules } from "@dv.net/ui-kit/dist/components/UiForm/types";
|
23 | 23 | import { isValidUrl } from "@shared/utils/helpers/general.ts";
|
| 24 | + import { STORE_SETTING_LABELS, STORE_SETTING_TOOLTIPS } from "@dv-admin/utils/constants/projects"; |
24 | 25 |
|
25 | 26 | const {
|
26 | 27 | currentProject,
|
27 | 28 | currenciesProject,
|
28 | 29 | isLoadingEditProject,
|
29 | 30 | checkedCurrenciesProject,
|
30 |
| - selectAllCurrenciesProject |
| 31 | + selectAllCurrenciesProject, |
| 32 | + storeSettingList |
31 | 33 | } = storeToRefs(useProjectsStore());
|
32 | 34 | const { dictionary } = storeToRefs(useGeneralStore());
|
33 | 35 | const { putOneProject, getCurrenciesProject } = useProjectsStore();
|
|
82 | 84 | if (!currentProject.value) return;
|
83 | 85 | if (!formRef.value || !(await formRef.value.validate())) return;
|
84 | 86 | await putApiCurrenciesProject(uuid, { currency_ids: checkedCurrenciesProject.value });
|
| 87 | + await Promise.all( |
| 88 | + storeSettingList.value |
| 89 | + .map(({ name, value }) => postApiStoreSetting(uuid, { name, value: value ? "enabled" : "disabled" })) |
| 90 | + ) |
85 | 91 | await putOneProject(t("The project has been saved"));
|
86 | 92 | await getCurrenciesProject(uuid);
|
87 | 93 | };
|
|
129 | 135 | </div>
|
130 | 136 | </block-section>
|
131 | 137 | <block-section class="store" mode="grey">
|
132 |
| - <div class="row"> |
133 |
| - <h4 class="row__title">{{ $t("Store status") }}</h4> |
134 |
| - <div class="row__actions"> |
135 |
| - <p class="row__actions-text"> |
136 |
| - {{ $t("When you turn off a store, you also stop accepting payments for all invoices for that store") }} |
137 |
| - </p> |
138 |
| - <ui-switch v-model="currentProject.status" :text="$t('Store enabled')" /> |
| 138 | + <div class="configuration"> |
| 139 | + <h2 class="global-title-h3">{{ $t("Configuration") }}</h2> |
| 140 | + <div class="configuration__list"> |
| 141 | + <div class="configuration__item"> |
| 142 | + <ui-switch v-model="currentProject.status" :text="$t('Store status')" /> |
| 143 | + <tooltip-helper |
| 144 | + :title="$t('Store status')" |
| 145 | + :text="$t('When you turn off a store, you also stop accepting payments for all invoices for that store')" |
| 146 | + /> |
| 147 | + </div> |
| 148 | + <div v-for="item in storeSettingList" :key="item.name" class="configuration__item"> |
| 149 | + <ui-switch |
| 150 | + v-model="item.value" |
| 151 | + :text="item.name in STORE_SETTING_LABELS ? $t(STORE_SETTING_LABELS[item.name]) : item.name" |
| 152 | + /> |
| 153 | + <tooltip-helper |
| 154 | + :title="item.name in STORE_SETTING_LABELS ? $t(STORE_SETTING_LABELS[item.name]) : item.name" |
| 155 | + :text="item.name in STORE_SETTING_TOOLTIPS ? $t(STORE_SETTING_TOOLTIPS[item.name]) : item.name" |
| 156 | + /> |
| 157 | + </div> |
139 | 158 | </div>
|
140 | 159 | </div>
|
141 | 160 | <div class="row" v-if="currenciesProject?.length">
|
|
303 | 322 | }
|
304 | 323 | }
|
305 | 324 | }
|
| 325 | + .configuration { |
| 326 | + display: flex; |
| 327 | + flex-direction: column; |
| 328 | + gap: 16px; |
| 329 | + border-bottom: 1px solid #e1e8f1; |
| 330 | + padding-bottom: 24px; |
| 331 | + &__list { |
| 332 | + display: flex; |
| 333 | + align-items: center; |
| 334 | + gap: 24px; |
| 335 | + } |
| 336 | + &__item { |
| 337 | + display: flex; |
| 338 | + align-items: center; |
| 339 | + gap: 8px; |
| 340 | + padding-right: 24px; |
| 341 | + border-right: 1px solid $grey; |
| 342 | + &:deep(.ui-switch__label) > p { |
| 343 | + font-size: 14px; |
| 344 | + } |
| 345 | + &:last-child { |
| 346 | + border-right: unset; |
| 347 | + } |
| 348 | + } |
| 349 | + } |
306 | 350 | }
|
307 | 351 | </style>
|
0 commit comments