@7365admin1/layer-common 4.146.0 → 4.147.1

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,18 +1,27 @@
1
1
  <template>
2
2
  <v-card width="100%" class="screen-modal visitor-select">
3
- <v-card-title class="text-capitalize">{{ mode }} Visitor</v-card-title>
3
+ <!-- Register (iSecure `VisitorTypeDialog`): "Register {plate} as", with
4
+ the plate highlighted, or "Select visitor type" without one. -->
5
+ <v-card-title v-if="mode === 'register'">
6
+ <template v-if="plate">
7
+ Register <span class="visitor-select__plate">{{ plate }}</span> as
8
+ </template>
9
+ <template v-else>Select visitor type</template>
10
+ </v-card-title>
11
+ <v-card-title v-else class="text-capitalize">{{ mode }} Visitor</v-card-title>
4
12
 
5
13
  <div class="screen-modal__body visitor-select__body">
6
- <p class="visitor-select__hint">Please Select Visitor Type</p>
7
- <template v-for="item in selection" :key="item.value">
8
- <AppButton
9
- v-if="showSelection(item)"
10
- class="visitor-select__option"
11
- @click="select(item.value)"
12
- >
13
- {{ item.label }}
14
- </AppButton>
15
- </template>
14
+ <p v-if="mode !== 'register'" class="visitor-select__hint">
15
+ Please Select Visitor Type
16
+ </p>
17
+ <AppButton
18
+ v-for="item in selection"
19
+ :key="item.value"
20
+ class="visitor-select__option"
21
+ @click="select(item.value)"
22
+ >
23
+ {{ item.label }}
24
+ </AppButton>
16
25
  </div>
17
26
 
18
27
  <div class="visitor-select__footer">
@@ -27,10 +36,35 @@ const prop = defineProps({
27
36
  type: String as PropType<"add" | "edit" | "register">,
28
37
  default: "add",
29
38
  },
39
+ /** The plate being registered (register mode), shown in the title. */
40
+ plateNumber: {
41
+ type: String,
42
+ default: "",
43
+ },
30
44
  });
31
45
 
32
46
  const emit = defineEmits(['cancel', 'select']);
33
- const { visitorSelection: selection} = useVisitor();
47
+ const { visitorSelection } = useVisitor();
48
+
49
+ const plate = computed(() => String(prop.plateNumber ?? "").trim().toUpperCase());
50
+
51
+ /*
52
+ * iSecure's orders. Add: Guest, Contractor, Delivery, Walk-In, Pick-Up,
53
+ * Drop-Off (`VISITOR_FORM_TYPES`). Register: Guest, Delivery, Pick-up,
54
+ * Drop-off, Contractor (`VisitorTypeDialog`; no Walk-In - a camera read is a
55
+ * vehicle). The values are the ones the form already takes.
56
+ */
57
+ const REGISTER_SELECTION = [
58
+ { label: "Guest", value: "guest" },
59
+ { label: "Delivery", value: "delivery" },
60
+ { label: "Pick-up", value: "pick-up" },
61
+ { label: "Drop-off", value: "drop-off" },
62
+ { label: "Contractor", value: "contractor" },
63
+ ];
64
+
65
+ const selection = computed(() =>
66
+ prop.mode === "register" ? REGISTER_SELECTION : visitorSelection
67
+ );
34
68
 
35
69
 
36
70
 
@@ -42,12 +76,6 @@ function select(value: string) {
42
76
  emit("select", value);
43
77
  }
44
78
 
45
- function showSelection(item: any) {
46
- if(item.value === 'walk-in' && prop.mode === 'register') {
47
- return false ;
48
- } return true;
49
-
50
- }
51
79
  </script>
52
80
 
53
81
  <style scoped>
@@ -69,6 +97,11 @@ function showSelection(item: any) {
69
97
  margin-bottom: 10px;
70
98
  }
71
99
 
100
+ .visitor-select__plate {
101
+ color: var(--accent-text);
102
+ font-weight: 700;
103
+ }
104
+
72
105
  .visitor-select__footer {
73
106
  display: flex;
74
107
  justify-content: flex-end;