adata-ui 2.0.21 → 2.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { computed, reactive, ref } from 'vue'
3
- import { useToggle } from '@vueuse/shared'
2
+ import Accept from '#adata-ui/components/modals/Accept.vue'
4
3
  import { PAGES } from '#adata-ui/shared/constans/pages'
4
+ import { useToggle } from '@vueuse/shared'
5
5
 
6
- import Accept from '#adata-ui/components/modals/Accept.vue'
6
+ import { computed, reactive, ref } from 'vue'
7
7
 
8
8
  import * as z from 'zod'
9
9
 
@@ -11,12 +11,11 @@ const { $toast } = useNuxtApp()
11
11
  const route = useRoute()
12
12
 
13
13
  const localePath = useLocalePath()
14
- const { t, locale} = useI18n()
14
+ const { t, locale } = useI18n()
15
15
  const { myLayer, commonAuth }: any = useAppConfig()
16
16
  const authApiURL = commonAuth.authApiURL
17
17
  const redirectUrl = useCookie('redirect_url')
18
- const registrationModal = useRegistrationModal()
19
- const loginModal = useLoginModal()
18
+ const { loginModal, registrationModal } = useIdModals()
20
19
 
21
20
  export interface RegistrationForm {
22
21
  email: string
@@ -76,12 +75,12 @@ async function onSubmit() {
76
75
  try {
77
76
  loading.value = true
78
77
  const { data, message } = await $fetch(`${authApiURL}/register`, {
79
- method: "POST",
80
- credentials: "include",
78
+ method: 'POST',
79
+ credentials: 'include',
81
80
  headers: {
82
81
  lang: locale.value,
83
82
  },
84
- body: form
83
+ body: form,
85
84
  })
86
85
  if (data) {
87
86
  registrationModal.value = false
@@ -110,9 +109,8 @@ function goBack() {
110
109
  // });
111
110
 
112
111
  async function onResend() {
113
-
114
- const emailResend = await fetch(`${authApiURL}/email/resend`,{
115
- method: "GET",
112
+ const emailResend = await fetch(`${authApiURL}/email/resend`, {
113
+ method: 'GET',
116
114
  credentials: 'include',
117
115
  headers: {
118
116
  lang: locale.value,
@@ -132,7 +130,7 @@ function getUrl() {
132
130
  : myLayer.landingUrl + PAGES.userAgreement, {
133
131
  external: true,
134
132
  open: {
135
- target: "_blank",
133
+ target: '_blank',
136
134
  },
137
135
  })
138
136
  }
@@ -144,8 +142,8 @@ function handleEnter(event: KeyboardEvent) {
144
142
  }
145
143
 
146
144
  function onLogin() {
147
- registrationModal.value = false
148
- loginModal.value = true
145
+ registrationModal.value = false
146
+ loginModal.value = true
149
147
  }
150
148
 
151
149
  watch(registrationModal, (value) => {
@@ -157,7 +155,6 @@ watch(registrationModal, (value) => {
157
155
  }
158
156
  })
159
157
 
160
-
161
158
  onMounted(() => {
162
159
  document.addEventListener('keyup', handleEnter)
163
160
  })
@@ -170,7 +167,7 @@ onBeforeUnmount(() => {
170
167
  <template>
171
168
  <a-modal v-model="registrationModal">
172
169
  <form
173
- class="flex flex-col items-stretch gap-5 rounded-lg bg-white dark:bg-gray-900"
170
+ class="flex flex-col items-stretch gap-5"
174
171
  novalidate
175
172
  @submit.prevent="onSubmit"
176
173
  >
@@ -9,7 +9,8 @@ const emit = defineEmits<{
9
9
  (e: 'confirm', otp: string): void
10
10
  (e: 'close'): void
11
11
  }>()
12
- const isOpen = defineModel()
12
+ const { t } = useI18n()
13
+ const isOpen = defineModel({ default: false })
13
14
  const showError = defineModel('error')
14
15
  const otp = ref(['', '', '', '', '', ''])
15
16
  const otpFormatted = computed(() => {
@@ -41,16 +42,16 @@ onBeforeUnmount(() => {
41
42
  </script>
42
43
 
43
44
  <template>
44
- <a-modal @close="close" v-model="isOpen">
45
+ <a-modal v-model="isOpen" @close="close">
45
46
  <div class="flex flex-col items-center justify-center gap-5">
46
47
  <p class="heading-02 text-center">
47
- {{ $t('twoFactor.title') }}
48
+ {{ t('modals.id.twoFactor.title') }}
48
49
  </p>
49
- <a-icon-hand-with-phone-light class="dark:hidden size-32" />
50
- <a-icon-hand-with-phone-dark class="hidden dark:block size-32" />
50
+ <a-icon-hand-with-phone-light class="size-32 dark:hidden" />
51
+ <a-icon-hand-with-phone-dark class="hidden size-32 dark:block" />
51
52
  <otp-input v-model="otp" v-model:error="showError" />
52
53
  <p class="body-400 text-center">
53
- {{ $t('twoFactor.code') }}
54
+ {{ $t('modals.id.twoFactor.code') }}
54
55
  </p>
55
56
  <div class="flex w-full gap-2">
56
57
  <a-button
@@ -58,7 +59,7 @@ onBeforeUnmount(() => {
58
59
  view="outline"
59
60
  @click="close"
60
61
  >
61
- {{ $t('twoFactor.close') }}
62
+ {{ t('modals.id.twoFactor.close') }}
62
63
  </a-button>
63
64
  <a-button
64
65
  :loading="loading"
@@ -66,7 +67,7 @@ onBeforeUnmount(() => {
66
67
  class="w-full"
67
68
  @click="confirm"
68
69
  >
69
- {{ $t('twoFactor.confirm') }}
70
+ {{ t('modals.id.twoFactor.confirm') }}
70
71
  </a-button>
71
72
  </div>
72
73
  </div>
@@ -1,11 +1,18 @@
1
1
  <script setup lang="ts" generic="T extends NavigationItem">
2
+ import Avatar from '#adata-ui/icons/avatar.vue'
3
+ import IconLogout from '#adata-ui/icons/logout.vue'
2
4
 
3
- import Avatar from "#adata-ui/icons/avatar.vue";
4
- import IconLogout from "#adata-ui/icons/logout.vue";
5
-
6
- const {t} = useI18n()
7
- const appConfig = useAppConfig()
8
- const loginUrl = appConfig.myLayer.loginUrl
5
+ const props = withDefaults(defineProps<Props>(), {
6
+ limitRemaining: 0,
7
+ daysRemaining: 0,
8
+ balance: 0,
9
+ rate: 'Базовый',
10
+ showLogIn: true,
11
+ })
12
+ const emit = defineEmits(['update:modelValue', 'logout'])
13
+ const { t } = useI18n()
14
+ const { myLayer } = useAppConfig()
15
+ const loginUrl = myLayer.loginUrl
9
16
 
10
17
  interface Props {
11
18
  grow?: boolean
@@ -22,34 +29,31 @@ interface Props {
22
29
  showLogIn?: boolean
23
30
  }
24
31
 
25
- const props = withDefaults(defineProps<Props>(), {
26
- limitRemaining: 0,
27
- daysRemaining: 0,
28
- balance: 0,
29
- rate: 'Базовый',
30
- showLogIn: true
31
- })
32
- const emit = defineEmits(['update:modelValue', 'logout'])
32
+ const { loginModal } = useIdModals()
33
33
 
34
- const goAuth = () => {
35
- if (window) {
36
- let fullPath = encodeURIComponent(window.location.toString())
37
- if (fullPath.includes('basic-info')) {
38
- fullPath = fullPath.replace('%2Fcounterparty/main', '').replace('%2Fbasic-info', '')
34
+ function goAuth() {
35
+ if (myLayer.authMode !== 'local') {
36
+ if (window) {
37
+ let fullPath = encodeURIComponent(window.location.toString())
38
+ if (fullPath.includes('basic-info')) {
39
+ fullPath = fullPath.replace('%2Fcounterparty/main', '').replace('%2Fbasic-info', '')
40
+ }
41
+ window.location.href = `${loginUrl}?url=${fullPath}`
39
42
  }
40
- window.location.href = `${loginUrl}?url=${fullPath}`
43
+ }
44
+ else {
45
+ loginModal.value = true
41
46
  }
42
47
  }
43
- const onClick = (value: string) => {
48
+ function onClick(value: string) {
44
49
  if (value === props.modelValue) value = ''
45
50
  emit('update:modelValue', value)
46
51
  }
47
52
 
48
- const login: string = 'header.login';
49
- const profile: string = 'modals.mobile_navigation.type_profile';
50
-
51
-
53
+ const login: string = 'header.login'
54
+ const profile: string = 'modals.mobile_navigation.type_profile'
52
55
  </script>
56
+
53
57
  <template>
54
58
  <header class="w-full border-t border-[#9DA3AC80] bg-white dark:bg-gray-900">
55
59
  <div class="grid w-full grid-cols-3 justify-items-center">
@@ -65,7 +69,7 @@ const profile: string = 'modals.mobile_navigation.type_profile';
65
69
  <template v-if="Object.prototype.hasOwnProperty.call(item, 'icon')">
66
70
  <component
67
71
  :is="item.icon"
68
- class="h-6 w-6"
72
+ class="size-6"
69
73
  />
70
74
  </template>
71
75
  {{ t(item.label) }}
@@ -73,12 +77,12 @@ const profile: string = 'modals.mobile_navigation.type_profile';
73
77
  </button>
74
78
  <button
75
79
  v-show="isAuthenticated"
76
- @click="onClick('profile')"
77
80
  class="h-16 w-auto min-w-16 max-w-[168px]"
81
+ @click="onClick('profile')"
78
82
  >
79
83
  <span class="flex flex-col items-center justify-center text-[10px] leading-5 lg:text-sm">
80
84
  <avatar
81
- class="bg-gray outline-blue h-6 w-6 rounded-full"
85
+ class="bg-gray outline-blue size-6 rounded-full"
82
86
  />
83
87
  {{ t(profile) }}
84
88
  </span>
@@ -89,7 +93,7 @@ const profile: string = 'modals.mobile_navigation.type_profile';
89
93
  @click="goAuth"
90
94
  >
91
95
  <span class="flex flex-col items-center justify-center text-[10px] leading-5 lg:text-sm">
92
- <icon-logout class="lg:h-6 lg:w-6" />
96
+ <icon-logout class="lg:size-6" />
93
97
  {{ t(login) }}
94
98
  </span>
95
99
  </button>
@@ -1,20 +1,31 @@
1
1
  <script lang="ts" setup>
2
- import AdataLogo from '#adata-ui/icons/adata-logo.vue'
2
+ import type { ProjectKeys } from '#adata-ui/components/navigation/header/types'
3
3
  import AColorMode from '#adata-ui/components/features/color-mode/AColorMode.client.vue'
4
- import Arrow from '#adata-ui/icons/chevron/chevron-down.vue'
5
- import HeaderLink from './HeaderLink.vue'
6
- import ProfileMenu from '#adata-ui/components/navigation/header/ProfileMenu.vue'
7
- import IconLogout from '#adata-ui/icons/logout.vue'
8
- import TopHeader from '#adata-ui/components/navigation/header/TopHeader.vue'
9
4
  import LangSwitcher from '#adata-ui/components/features/lang-switcher/lang-switcher.vue'
10
5
  import AChangeVersion from '#adata-ui/components/features/сhange-version/AChangeVersion.vue'
11
- import Logo from '#adata-ui/icons/logo.vue'
12
- import type { ProjectKeys } from '#adata-ui/components/navigation/header/types'
6
+ import ProfileMenu from '#adata-ui/components/navigation/header/ProfileMenu.vue'
7
+ import TopHeader from '#adata-ui/components/navigation/header/TopHeader.vue'
13
8
  import { useContacts, useCurrentModule } from '#adata-ui/composables/projectState'
14
- import { navigateToLocalizedPage, buildLocalizedUrl } from '#adata-ui/utils/localizedNavigation'
9
+ import AdataLogo from '#adata-ui/icons/adata-logo.vue'
10
+ import Arrow from '#adata-ui/icons/chevron/chevron-down.vue'
11
+ import Logo from '#adata-ui/icons/logo.vue'
12
+ import { buildLocalizedUrl, navigateToLocalizedPage } from '#adata-ui/utils/localizedNavigation'
13
+ import HeaderLink from './HeaderLink.vue'
15
14
 
16
15
  defineOptions({ name: 'AHeader' })
17
16
 
17
+ const props = withDefaults(defineProps<Props>(), {
18
+ limitRemaining: 0,
19
+ daysRemaining: 0,
20
+ balance: 0,
21
+ rate: 'Базовый',
22
+ showLogIn: true,
23
+ mobileHeaderType: 'default',
24
+ module: 'pk',
25
+ })
26
+
27
+ const emit = defineEmits(['logout', 'search', 'login'])
28
+
18
29
  interface Props {
19
30
  replenish?: string
20
31
  hasNotification?: boolean
@@ -28,22 +39,8 @@ interface Props {
28
39
  mobileHeaderType?: 'search' | 'default'
29
40
  module?: ProjectKeys
30
41
  oldVersion?: string
31
- authMode?: 'local' | 'separate'
32
42
  }
33
43
 
34
- const props = withDefaults(defineProps<Props>(), {
35
- limitRemaining: 0,
36
- daysRemaining: 0,
37
- balance: 0,
38
- rate: 'Базовый',
39
- showLogIn: true,
40
- mobileHeaderType: 'default',
41
- module: 'pk',
42
- authMode: 'separate',
43
- })
44
-
45
- const emit = defineEmits(['logout', 'search', 'login'])
46
-
47
44
  const { t } = useI18n()
48
45
  const { locale } = useI18n()
49
46
 
@@ -53,10 +50,10 @@ const { myLayer }: any = useAppConfig()
53
50
 
54
51
  const langIsOn = appConfig.myLayer.langIsOn
55
52
  const contacts = ref(useContacts())
56
- const loginModal = useLoginModal()
53
+ const { loginModal } = useIdModals()
57
54
 
58
- const goAuth = () => {
59
- if (props.authMode === 'separate') {
55
+ function goAuth() {
56
+ if (myLayer.authMode !== 'local') {
60
57
  if (window) {
61
58
  emit('login')
62
59
  let fullPath = encodeURIComponent(window.location.toString())
@@ -68,7 +65,7 @@ const goAuth = () => {
68
65
  locale,
69
66
  projectUrl: myLayer.loginUrl.slice(0, -1),
70
67
  path: `/?url=${fullPath}`,
71
- target: '_self'
68
+ target: '_self',
72
69
  })
73
70
  }
74
71
  }
@@ -77,18 +74,19 @@ const goAuth = () => {
77
74
  }
78
75
  }
79
76
 
80
- const goToAnotherModule = () => {
77
+ function goToAnotherModule() {
81
78
  location.href = buildLocalizedUrl(locale.value, myLayer.landingUrl, '')
82
79
  }
83
80
 
84
- const fetchContacts = async () => {
81
+ async function fetchContacts() {
85
82
  try {
86
83
  const response = await fetch(
87
- 'https://pk-api.adata.kz/api/v1/data/counterparty/contacts/sales-department'
84
+ 'https://pk-api.adata.kz/api/v1/data/counterparty/contacts/sales-department',
88
85
  )
89
86
  const { data } = await response.json()
90
87
  contacts.value = data
91
- } catch (e) {
88
+ }
89
+ catch (e) {
92
90
  console.error(e.message)
93
91
  }
94
92
  }
@@ -110,7 +108,7 @@ onBeforeMount(() => {
110
108
  class="relative h-16 border-b border-deepblue-900/10 bg-white dark:border-gray-200/10 dark:bg-gray-900"
111
109
  >
112
110
  <div class="a-container mobile-padding flex h-full items-center justify-between gap-2">
113
- <!-- Desktop hidden-->
111
+ <!-- Desktop hidden -->
114
112
  <section
115
113
  id="mobile-header"
116
114
  class="grow lg:hidden"
@@ -154,7 +152,7 @@ onBeforeMount(() => {
154
152
  class="lg:hidden"
155
153
  />
156
154
  </div>
157
- <!--Mobile hidden-->
155
+ <!-- Mobile hidden -->
158
156
  <nav class="hidden items-center gap-4 lg:flex">
159
157
  <nuxt-link-locale
160
158
  aria-label="Adata-logo"
@@ -170,7 +168,7 @@ onBeforeMount(() => {
170
168
  <header-link />
171
169
  </nav>
172
170
  <div class="text-deepblue hidden items-center gap-4 dark:text-[#E3E5E8] lg:flex">
173
- <!--Mobile hidden-->
171
+ <!-- Mobile hidden -->
174
172
  <div class="hidden items-center gap-4 lg:flex">
175
173
  <a-change-version
176
174
  v-if="oldVersion"
@@ -212,11 +210,6 @@ onBeforeMount(() => {
212
210
  </div>
213
211
  </header>
214
212
  </div>
215
-
216
- <template v-if="authMode === 'local'">
217
- <a-login />
218
- <a-registration />
219
- </template>
220
213
  </template>
221
214
 
222
215
  <style scoped></style>
@@ -6,6 +6,3 @@ export const usePaymentMethodModal = () => useState<boolean>('payment-method-mod
6
6
  export const useReplenishModal = () => useState<boolean>('replenish-modal', () => false)
7
7
  export const useLowBalanceModal = () => useState<boolean>('low-balance-modal', () => false)
8
8
  export const useNoAccessModal = () => useState<boolean>('no-access-modal', () => false)
9
-
10
- export const useLoginModal = () => useState<boolean>('login-modal', () => false)
11
- export const useRegistrationModal = () => useState<boolean>('registration-modal', () => false)
@@ -117,21 +117,26 @@ export const useHeaderNavigationLinks = () => {
117
117
  }
118
118
  ]
119
119
  },
120
+
120
121
  {
121
- key: 'compliance',
122
- is_new: true,
123
- name: t('header.products.compliance.label'),
124
- icon: AIconId,
122
+ key: 'work',
123
+ name: t('header.products.jobs.label'),
124
+ icon: AIconWorkBag,
125
125
  items: [
126
126
  {
127
- title: t('header.products.compliance.items.l.t'),
128
- subtitle: t('header.products.compliance.items.l.st'),
129
- icon: IconProfile,
130
- to: buildLocalizedUrl(locale, `${myLayer.complianceUrl}/compliance`, '')
127
+ title: t('header.products.jobs.items.vacancies.title'),
128
+ icon: IconWork,
129
+ subtitle: t('header.products.jobs.items.vacancies.subtitle'),
130
+ to: myLayer.workUrl + PAGES.work.vacancy
131
+ },
132
+ {
133
+ title: t('header.products.jobs.items.resume.title'),
134
+ subtitle: t('header.products.jobs.items.resume.subtitle'),
135
+ icon: IconDocument,
136
+ to: myLayer.workUrl + PAGES.work.summary
131
137
  }
132
138
  ]
133
139
  },
134
-
135
140
  {
136
141
  key: 'tenders',
137
142
  name: t('header.products.tenders.label'),
@@ -267,21 +272,16 @@ export const useHeaderNavigationLinks = () => {
267
272
  ]
268
273
  },
269
274
  {
270
- key: 'work',
271
- name: t('header.products.jobs.label'),
272
- icon: AIconWorkBag,
275
+ key: 'compliance',
276
+ is_new: true,
277
+ name: t('header.products.compliance.label'),
278
+ icon: AIconId,
273
279
  items: [
274
280
  {
275
- title: t('header.products.jobs.items.vacancies.title'),
276
- icon: IconWork,
277
- subtitle: t('header.products.jobs.items.vacancies.subtitle'),
278
- to: myLayer.workUrl + PAGES.work.vacancy
279
- },
280
- {
281
- title: t('header.products.jobs.items.resume.title'),
282
- subtitle: t('header.products.jobs.items.resume.subtitle'),
283
- icon: IconDocument,
284
- to: myLayer.workUrl + PAGES.work.summary
281
+ title: t('header.products.compliance.items.l.t'),
282
+ subtitle: t('header.products.compliance.items.l.st'),
283
+ icon: IconProfile,
284
+ to: buildLocalizedUrl(locale, `${myLayer.complianceUrl}/compliance`, '')
285
285
  }
286
286
  ]
287
287
  },
@@ -0,0 +1,17 @@
1
+ export function useIdModals() {
2
+ const loginModal = useState('login-modal', () => false)
3
+ const registrationModal = useState('registration-modal', () => false)
4
+ const recoveryModal = useState('recovery-modal', () => false)
5
+ const emailModal = useState('email-modal', () => false)
6
+ const newPasswordModal = useState('new-password-modal', () => false)
7
+ const passwordSuccessfulModal = useState('password-successful-modal', () => false)
8
+
9
+ return {
10
+ loginModal,
11
+ registrationModal,
12
+ recoveryModal,
13
+ emailModal,
14
+ newPasswordModal,
15
+ passwordSuccessfulModal,
16
+ }
17
+ }
@@ -0,0 +1,45 @@
1
+ import antfu from '@antfu/eslint-config'
2
+ import tailwind from 'eslint-plugin-tailwindcss'
3
+ import withNuxt from './.nuxt/eslint.config.mjs'
4
+
5
+ export default withNuxt(
6
+ ...tailwind.configs['flat/recommended'],
7
+ await antfu({
8
+ javascript: {
9
+ overrides: {
10
+ 'no-console': ['off'],
11
+ 'unused-imports/no-unused-vars': ['warn'],
12
+ },
13
+ },
14
+ typescript: {
15
+ overrides: {
16
+ 'node/prefer-global/process': ['off'],
17
+ },
18
+ },
19
+ stylistic: {
20
+ overrides: {
21
+ 'antfu/if-newline': ['off'],
22
+ },
23
+ },
24
+ vue: {
25
+ overrides: {
26
+ 'vue/component-name-in-template-casing': ['error', 'kebab-case', {
27
+ registeredComponentsOnly: false,
28
+ ignores: ['Line', 'Bar', 'Doughnut'],
29
+ }],
30
+ 'vue/max-attributes-per-line': ['warn', {
31
+ singleline: {
32
+ max: 2,
33
+ },
34
+ multiline: {
35
+ max: 1,
36
+ },
37
+ }],
38
+ 'vue/no-dupe-keys': ['error'],
39
+ 'vue/no-multiple-template-root': ['off'],
40
+ 'tailwindcss/no-custom-classname': ['off'],
41
+ 'tailwindcss/enforces-negative-arbitrary-values': ['warn'],
42
+ },
43
+ },
44
+ }),
45
+ )