hl-core 0.0.7-beta.10 → 0.0.7-beta.11

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.
@@ -3,7 +3,7 @@
3
3
  type="button"
4
4
  class="transition-all"
5
5
  @click="$emit('clicked')"
6
- :disabled="disabled"
6
+ :disabled="disabled || loading"
7
7
  :class="[
8
8
  disabled ? 'disabled' : '',
9
9
  classes,
@@ -11,7 +11,8 @@
11
11
  $libStyles[`btnH${$capitalize(size)}` as keyof typeof $libStyles],
12
12
  ]"
13
13
  >
14
- {{ text }}
14
+ <base-loader v-if="loading" :size="24" color="#FFF" bg-color="" :width="2"></base-loader>
15
+ <span v-if="!loading">{{ text }}</span>
15
16
  </button>
16
17
  </template>
17
18
 
@@ -35,6 +36,10 @@ export default defineComponent({
35
36
  type: Boolean,
36
37
  default: false,
37
38
  },
39
+ loading: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
38
43
  btn: {
39
44
  type: String,
40
45
  default: new Styles().blueBtn,
@@ -6,7 +6,7 @@
6
6
  class="sm:!w-[400px] lg:!relative !right-0"
7
7
  :class="[$dataStore[whichPanel].overlay ? 'lg:!hidden' : '', $dataStore[whichPanel].open ? '!w-full lg:!w-[420px]' : 'lg:!w-[0px]']"
8
8
  >
9
- <base-header :title="panelTitle" :has-back="true" back-icon="mdi-close" class="justify-center" @onBack="$dataStore[whichPanel].open = false"></base-header>
9
+ <base-header :title="panelTitle" :has-back="true" back-icon="mdi-close" class="justify-center" @onBack="closePanel"></base-header>
10
10
  <div class="flex flex-col" id="panel-actions">
11
11
  <slot></slot>
12
12
  </div>
@@ -26,8 +26,17 @@ export default defineComponent({
26
26
  default: 'panel',
27
27
  },
28
28
  },
29
- setup() {
30
- return {};
29
+ setup(props) {
30
+ const dataStore = useDataStore();
31
+
32
+ const closePanel = () => {
33
+ dataStore[props.whichPanel].open = false;
34
+ dataStore.panelAction = null;
35
+ };
36
+
37
+ return {
38
+ closePanel,
39
+ };
31
40
  },
32
41
  });
33
42
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <aside class="w-full lg:w-1/4 bg-white flex flex-col border-r-2">
2
+ <aside class="w-full lg:w-1/4 bg-white flex flex-col border-r-2 relative">
3
3
  <base-header
4
4
  class="justify-center"
5
5
  :title="title"
@@ -29,6 +29,32 @@
29
29
  </div>
30
30
  </base-fade-transition>
31
31
  <slot name="end"></slot>
32
+ <slot name="actions"></slot>
33
+ <base-fade-transition>
34
+ <div
35
+ v-if="$dataStore.buttons && $dataStore.buttons.length"
36
+ class="flex flex-col gap-[10px] justify-self-end absolute bottom-5 lg:bottom-[30%] w-full pr-4"
37
+ >
38
+ <div v-for="(item, index) of $dataStore.buttons" :key="index">
39
+ <transition
40
+ enter-active-class="animate__animated animate__fadeIn animate__faster"
41
+ leave-active-class="animate__animated animate__fadeOut animate__faster"
42
+ >
43
+ <base-btn
44
+ v-if="
45
+ 'show' in item && typeof item.show === 'boolean'
46
+ ? item.show
47
+ : true
48
+ "
49
+ :text="item.title!"
50
+ :btn="item.color"
51
+ :disabled="!!item.disabled"
52
+ @click="item.action"
53
+ >
54
+ </base-btn>
55
+ </transition>
56
+ </div></div
57
+ ></base-fade-transition>
32
58
  </section>
33
59
  </aside>
34
60
  </template>
@@ -12,7 +12,11 @@ class MenuItemConfig {
12
12
  url?: string | null;
13
13
  initial?: object | null;
14
14
  icon?: string | null;
15
- action?: Function;
15
+ action?: Function | void;
16
+ disabled?: typeof computed;
17
+ color?: string;
18
+ show?: typeof computed;
19
+
16
20
  constructor(
17
21
  id: any = null,
18
22
  title: string | null = null,
@@ -22,7 +26,10 @@ class MenuItemConfig {
22
26
  url?: string | null,
23
27
  initial?: object | null,
24
28
  icon?: string | null,
25
- action?: Function,
29
+ action?: Function | void,
30
+ disabled?: typeof computed,
31
+ color?: string,
32
+ show?: typeof computed,
26
33
  ) {
27
34
  this.id = id;
28
35
  this.title = title;
@@ -33,12 +40,15 @@ class MenuItemConfig {
33
40
  this.initial = initial;
34
41
  this.icon = icon;
35
42
  this.action = action;
43
+ this.disabled = disabled;
44
+ this.color = color;
45
+ this.show = show;
36
46
  }
37
47
  }
38
48
 
39
49
  export class MenuItem extends MenuItemConfig {
40
- constructor({ id, title, link, hasLine, description, url, initial, icon, action }: MenuItemConfig = new MenuItemConfig()) {
41
- super(id, title, link, hasLine, description, url, initial, icon, action);
50
+ constructor({ id, title, link, hasLine, description, url, initial, icon, action, disabled, color, show }: MenuItemConfig = new MenuItemConfig()) {
51
+ super(id, title, link, hasLine, description, url, initial, icon, action, disabled, color, show);
42
52
  }
43
53
  }
44
54
 
@@ -768,6 +778,8 @@ export class DataStoreClass {
768
778
  overlay: boolean;
769
779
  items: MenuItem[];
770
780
  };
781
+ buttons: MenuItem[];
782
+ panelAction: string | null;
771
783
  panel: {
772
784
  open: boolean;
773
785
  overlay: boolean;
@@ -876,11 +888,13 @@ export class DataStoreClass {
876
888
  overlay: false,
877
889
  items: [],
878
890
  };
891
+ this.buttons = [];
879
892
  this.panel = {
880
893
  open: false,
881
894
  overlay: false,
882
895
  title: '',
883
896
  };
897
+ this.panelAction = null;
884
898
  this.historyPageIndex = 1;
885
899
  this.historyPageSize = 10;
886
900
  this.historyTotalItems = 0;
@@ -26,6 +26,8 @@ export const constants = Object.freeze({
26
26
  agentMycar: 'AgentMycar',
27
27
  analyst: 'Analyst',
28
28
  upk: 'UPK',
29
+ financeCenter: 'FinanceCenter',
30
+ supervisor: 'Supervisor',
29
31
  },
30
32
  actions: {
31
33
  accept: 'accept',
@@ -38,6 +40,13 @@ export const constants = Object.freeze({
38
40
  },
39
41
  yearCases: [2, 0, 1, 1, 1, 2],
40
42
  yearTitles: ['год', 'года', 'лет'],
43
+ panelActions: {
44
+ accept: 'accept',
45
+ claim: 'claim',
46
+ return: 'return',
47
+ reject: 'reject',
48
+ rejectclient: 'rejectclient',
49
+ },
41
50
  postActions: {
42
51
  route: 'route',
43
52
  applicationCreated: 'applicationCreated',
@@ -5,10 +5,12 @@ export class Styles {
5
5
  blackText: string = 'text-black';
6
6
  bodyBg: string = '!bg-[#F5F5F5]';
7
7
 
8
+ whiteTextHover: string = 'hover:text-[#FFFFFF]';
8
9
  // Blue
9
10
  blueBg: string = 'bg-[#A0B3D8]';
10
11
  blueBgHover: string = 'hover:bg-[#96abd6]';
11
12
  blueBgLight: string = 'bg-[#F3F6FC]';
13
+ blueBgLightHover: string = 'hover:bg-[#F3F6FC]';
12
14
  blueText: string = 'text-[#A0B3D8]';
13
15
  blueTextLight: string = 'text-[#F3F6FC]';
14
16
 
@@ -27,11 +29,11 @@ export class Styles {
27
29
  greyIconBg: string = 'bg-[#DADADA]';
28
30
  greyBtnBg: string = 'bg-[#EEE6E6]';
29
31
  greyBtnDisabledBg: string = 'bg-[#919191]';
30
-
32
+ blueLightBgHover: string = 'hover:bg-[#F3F6FC]';
31
33
  // Red
32
- redText: string = 'text-[#E46962]';
33
- redBg: string = 'bg-[#E46962]';
34
-
34
+ redText: string = 'text-[#FF897D]';
35
+ redBg: string = 'bg-[#FF897D]';
36
+ redBgHover: string = 'hover:bg-[#ff9b91]';
35
37
  // Error
36
38
  errorBg: string = 'bg-[#FF5449]';
37
39
  errorText: string = 'text-[#FF5449]';
@@ -48,17 +50,27 @@ export class Styles {
48
50
  btnHSm: string = 'h-[40px]';
49
51
  btnHMd: string = 'h-[60px]';
50
52
  btnHLg: string = 'h-[60px]';
51
-
52
- // Complex
53
53
  greenBtn: string;
54
54
  blueBtn: string;
55
+ redBtn: string;
56
+ whiteBtn: string;
57
+ blueLightBtn: string;
58
+
59
+ // Complex
60
+ flexColNav: string;
55
61
 
56
62
  // Muted or disabled
57
63
  mutedText: string = 'text-[#99A3B3]';
58
64
 
59
65
  constructor() {
60
- // Complex
66
+ // Button
61
67
  this.greenBtn = `${this.greenBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.greenBgHover}`;
68
+ this.redBtn = `${this.redBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.redBgHover}`;
62
69
  this.blueBtn = `${this.blueBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.blueBgHover}`;
70
+ this.whiteBtn = ` ${this.blackText} ${this.textTitle} ${this.rounded} w-full ${this.blueLightBgHover}`;
71
+ this.blueLightBtn = `${this.blueBgLight} ${this.greyTextLight} ${this.textTitle} ${this.rounded} w-full ${this.blueBgLightHover}`;
72
+
73
+ // Complex
74
+ this.flexColNav = 'flex flex-col gap-[10px] px-2 pt-[14px]';
63
75
  }
64
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.7-beta.10",
3
+ "version": "0.0.7-beta.11",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -91,7 +91,18 @@ export const useDataStore = defineStore('data', {
91
91
  this.refreshToken = response.refreshToken;
92
92
  this.getUserRoles();
93
93
  }
94
- if (this.isManager() || this.isUnderwriter() || this.isAdmin() || this.isAgent() || this.isCompliance() || this.isAgentMycar() || this.isAnalyst() || this.isUpk()) {
94
+ if (
95
+ this.isManager() ||
96
+ this.isUnderwriter() ||
97
+ this.isAdmin() ||
98
+ this.isAgent() ||
99
+ this.isCompliance() ||
100
+ this.isAgentMycar() ||
101
+ this.isAnalyst() ||
102
+ this.isUpk() ||
103
+ this.isFinanceCenter() ||
104
+ this.isSupervisor()
105
+ ) {
95
106
  localStorage.setItem('accessToken', this.accessToken);
96
107
  localStorage.setItem('refreshToken', this.refreshToken);
97
108
  } else {
@@ -154,6 +165,13 @@ export const useDataStore = defineStore('data', {
154
165
  isUpk() {
155
166
  return this.isRole(constants.roles.upk);
156
167
  },
168
+ isFinanceCenter() {
169
+ return this.isRole(constants.roles.financeCenter);
170
+ },
171
+ isSupervisor() {
172
+ return this.isRole(constants.roles.supervisor);
173
+ },
174
+
157
175
  isProcessEditable(statusCode) {
158
176
  return !!constants.editableStatuses.find(status => status === statusCode);
159
177
  },
@@ -1816,6 +1834,46 @@ export const useDataStore = defineStore('data', {
1816
1834
  return false;
1817
1835
  }
1818
1836
  },
1837
+ async handleTask(action, taskId, comment) {
1838
+ if (action && Object.keys(constants.actions).includes(action)) {
1839
+ switch (action) {
1840
+ case constants.actions.claim: {
1841
+ try {
1842
+ this.isLoading = true;
1843
+ await this.api.claimTask(this.formStore.applicationTaskId);
1844
+ await this.getApplicationData(taskId, false, false, false);
1845
+ this.showToaster('success', this.t('toaster.successOperation'), 3000);
1846
+ } catch (err) {
1847
+ console.log(err);
1848
+ if ('response' in err && err.response.data) {
1849
+ this.showToaster('error', err.response.data, 3000);
1850
+ }
1851
+ }
1852
+ }
1853
+ case constants.actions.reject:
1854
+ case constants.actions.return:
1855
+ case constants.actions.rejectclient:
1856
+ case constants.actions.accept: {
1857
+ try {
1858
+ await this.sendTask(taskId, action, comment);
1859
+ this.formStore.$reset();
1860
+ if (this.isEFO) {
1861
+ await this.router.push({ name: 'Insurance-Product' });
1862
+ } else {
1863
+ this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
1864
+ }
1865
+ } catch (err) {
1866
+ console.log(err);
1867
+ if ('response' in err && err.response.data) {
1868
+ this.showToaster('error', err.response.data, 3000);
1869
+ }
1870
+ }
1871
+ }
1872
+ }
1873
+ } else {
1874
+ console.error('No handleTask action');
1875
+ }
1876
+ },
1819
1877
  async getInvoiceData(processInstanceId) {
1820
1878
  try {
1821
1879
  const response = await this.api.getInvoiceData(processInstanceId);
package/store/messages.ts CHANGED
@@ -130,6 +130,8 @@ export const messages = {
130
130
  toPayment: 'Перейти к оплате',
131
131
  calcSum: 'Рассчитать сумму',
132
132
  calcPremium: 'Рассчитать премию',
133
+ accept: 'Одобрить',
134
+ reject: 'Отказать',
133
135
  },
134
136
  error: {
135
137
  title: 'Ошибка 404',