@shakerquiz/utilities 0.5.4 → 0.5.6
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.
package/package.json
CHANGED
|
@@ -3,9 +3,80 @@ export var CityAffilation = /** @type {const} */ ({
|
|
|
3
3
|
'Franchise': 'Franchise',
|
|
4
4
|
})
|
|
5
5
|
|
|
6
|
+
export var CityAffilations = Object.values(CityAffilation)
|
|
7
|
+
|
|
6
8
|
export var CityAffilationWeight = {
|
|
7
9
|
[CityAffilation.Branch]: 0,
|
|
8
10
|
[CityAffilation.Franchise]: 1,
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export var
|
|
13
|
+
export var CityAffilationTitle = {
|
|
14
|
+
[CityAffilation.Branch]: 'Филиал',
|
|
15
|
+
[CityAffilation.Franchise]: 'Франшиза',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export var CityAffilationActionTitle = {
|
|
19
|
+
[CityAffilation.Branch]: 'Назначить филиалом',
|
|
20
|
+
[CityAffilation.Franchise]: 'Назначить франшизой',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export var CityAffilationActionDescpription = {
|
|
24
|
+
[CityAffilation.Branch]: 'Изменить тип на: Филиал',
|
|
25
|
+
[CityAffilation.Franchise]: 'Изменить тип на: Франшиза',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export var CityAffilationColor = {
|
|
29
|
+
[CityAffilation.Branch]: 'primary',
|
|
30
|
+
[CityAffilation.Franchise]: 'secondary',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export var CityAffilationTextColor = {
|
|
34
|
+
[CityAffilation.Branch]: 'text-primary',
|
|
35
|
+
[CityAffilation.Franchise]: 'text-secondary',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @type {Record<CityAffilation, Icon>} */
|
|
39
|
+
export var CityAffilation = {
|
|
40
|
+
[CityAffilation.Branch]: 'hero/outline/building-office-2',
|
|
41
|
+
[CityAffilation.Franchise]: 'hero/outline/building-storefront',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @type {Record<CityAffilation, Pick<CityTable, 'is_franchise'>>} */
|
|
45
|
+
export var CityAffilationShape = {
|
|
46
|
+
[CityAffilation.Branch]: {
|
|
47
|
+
is_franchise: false,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
[CityAffilation.Reserve]: {
|
|
51
|
+
is_franchise: true,
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export var CityAffilationShapes = Object.entries(CityAffilationShape)
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {CityAffilation | typeof CityAffilationShape[CityAffilation]} value
|
|
59
|
+
*/
|
|
60
|
+
export var getCityAffilation = value => {
|
|
61
|
+
switch (typeof value) {
|
|
62
|
+
case 'object':
|
|
63
|
+
let found = CityAffilationShapes
|
|
64
|
+
.find(([, object]) => object.is_franchise === value.is_reserve)
|
|
65
|
+
?.at(0)
|
|
66
|
+
|
|
67
|
+
if (!CityAffilations.includes(found))
|
|
68
|
+
throw TypeError(
|
|
69
|
+
`[Function: getCityAffilation] Parameter 'found': '${found}' must be a member of 'Lineups'.`,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return found
|
|
73
|
+
|
|
74
|
+
case 'string':
|
|
75
|
+
if (!CityAffilations.includes(value))
|
|
76
|
+
throw TypeError(
|
|
77
|
+
`[Function: getCityAffilation] Parameter 'value': '${value}' must be a member of 'Lineups'.`,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
return CityAffilationShape[value]
|
|
81
|
+
}
|
|
82
|
+
}
|