Skip to content

Commit 00548f8

Browse files
authored
fix: fix some vue errors (#6685)
1 parent 7e77bea commit 00548f8

File tree

76 files changed

+432
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+432
-350
lines changed

app/Domains/Contact/ManageRelationships/Web/Controllers/ContactRelationshipsController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function store(Request $request, string $vaultId, string $contactId)
4545

4646
// first, let's create a contact if there is no contact selected
4747
$otherContactId = 0;
48-
if ($request->input('choice') != 'contact') {
48+
if ($request->input('choice') !== 'contact') {
4949
$otherContact = (new CreateContact())->execute([
5050
'account_id' => Auth::user()->account_id,
5151
'author_id' => Auth::id(),
@@ -61,9 +61,7 @@ public function store(Request $request, string $vaultId, string $contactId)
6161
'template_id' => null,
6262
]);
6363
$otherContactId = $otherContact->id;
64-
}
65-
66-
if ($request->input('choice') == 'contact') {
64+
} else {
6765
$otherContactId = collect($request->input('other_contact_id'))->pluck('id')->first();
6866
}
6967

@@ -72,8 +70,8 @@ public function store(Request $request, string $vaultId, string $contactId)
7270
'author_id' => Auth::id(),
7371
'vault_id' => $vaultId,
7472
'relationship_type_id' => $request->input('relationship_type_id'),
75-
'contact_id' => $request->input('base_contact_id') == $contactId ? $contactId : $otherContactId,
76-
'other_contact_id' => $request->input('base_contact_id') == $contactId ? $otherContactId : $contactId,
73+
'contact_id' => $request->input('base_contact_id') === $contactId ? $contactId : $otherContactId,
74+
'other_contact_id' => $request->input('base_contact_id') === $contactId ? $otherContactId : $contactId,
7775
]);
7876

7977
return response()->json([

app/Domains/Settings/ManageCallReasons/Web/ViewHelpers/PersonalizeCallReasonsIndexViewHelper.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public static function dtoReasonType(CallReasonType $type): array
3131
return [
3232
'id' => $type->id,
3333
'label' => $type->label,
34-
'reasons' => $type->callReasons->map(function ($reason) use ($type) {
35-
return self::dtoReason($type, $reason);
36-
}),
34+
'reasons' => $type->callReasons->map(fn ($reason) => self::dtoReason($type, $reason)),
3735
'url' => [
3836
'store' => route('settings.personalize.call_reasons.store', [
3937
'callReasonType' => $type->id,

app/Models/CallReason.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function callReasonType(): BelongsTo
4242
protected function label(): Attribute
4343
{
4444
return Attribute::make(
45-
get: function ($value, $attributes) {
46-
if (! $value) {
45+
get: function (?string $value, array $attributes) {
46+
if ($value === null) {
4747
return __($attributes['label_translation_key']);
4848
}
4949

resources/js/Components/DropdownLink.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ defineProps({
1010
<template>
1111
<div>
1212
<button
13-
v-if="as == 'button'"
13+
v-if="as === 'button'"
1414
type="submit"
1515
class="block w-full px-4 py-2 text-left text-sm leading-5 text-gray-700 transition hover:bg-gray-100 focus:bg-gray-100 focus:outline-none dark:text-gray-300 hover:dark:bg-gray-900">
1616
<slot />
1717
</button>
1818

1919
<a
20-
v-else-if="as == 'a'"
20+
v-else-if="as === 'a'"
2121
:href="href"
2222
class="block px-4 py-2 text-sm leading-5 text-gray-700 transition hover:bg-gray-100 focus:bg-gray-100 focus:outline-none dark:text-gray-300 hover:dark:bg-gray-900">
2323
<slot />

resources/js/Components/Jetstream/Banner.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ watch(message, async () => {
1313
1414
<template>
1515
<div>
16-
<div v-if="show && message" :class="{ 'bg-indigo-500': style == 'success', 'bg-red-700': style == 'danger' }">
16+
<div v-if="show && message" :class="{ 'bg-indigo-500': style === 'success', 'bg-red-700': style === 'danger' }">
1717
<div class="mx-auto max-w-screen-xl px-3 py-2 sm:px-6 lg:px-8">
1818
<div class="flex flex-wrap items-center justify-between">
1919
<div class="flex w-0 min-w-0 flex-1 items-center">
2020
<span
2121
class="flex rounded-lg p-2"
22-
:class="{ 'bg-indigo-600': style == 'success', 'bg-red-600': style == 'danger' }">
22+
:class="{ 'bg-indigo-600': style === 'success', 'bg-red-600': style === 'danger' }">
2323
<svg
24-
v-if="style == 'success'"
24+
v-if="style === 'success'"
2525
class="h-5 w-5 text-white"
2626
xmlns="http://www.w3.org/2000/svg"
2727
fill="none"
@@ -35,7 +35,7 @@ watch(message, async () => {
3535
</svg>
3636
3737
<svg
38-
v-if="style == 'danger'"
38+
v-if="style === 'danger'"
3939
class="h-5 w-5 text-white"
4040
xmlns="http://www.w3.org/2000/svg"
4141
fill="none"
@@ -59,8 +59,8 @@ watch(message, async () => {
5959
type="button"
6060
class="-me-1 flex rounded-md p-2 transition focus:outline-none sm:-me-2"
6161
:class="{
62-
'hover:bg-indigo-600 focus:bg-indigo-600': style == 'success',
63-
'hover:bg-red-600 focus:bg-red-600': style == 'danger',
62+
'hover:bg-indigo-600 focus:bg-indigo-600': style === 'success',
63+
'hover:bg-red-600 focus:bg-red-600': style === 'danger',
6464
}"
6565
:aria-label="$t('Dismiss')"
6666
@click.prevent="show = false">

resources/js/Components/ResponsiveNavLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const classes = computed(() => {
1717

1818
<template>
1919
<div>
20-
<button v-if="as == 'button'" :class="classes" class="w-full text-left">
20+
<button v-if="as === 'button'" :class="classes" class="w-full text-left">
2121
<slot />
2222
</button>
2323

resources/js/Pages/Settings/Notifications/Logs/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
<!-- blank state -->
107107
<div
108-
v-if="data.notifications.length == 0"
108+
v-if="data.notifications.length === 0"
109109
class="mb-6 rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900">
110110
<p class="p-5 text-center">
111111
{{ $t('You haven’t received a notification in this channel yet.') }}

resources/js/Pages/Settings/Notifications/Partials/Emails.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@
137137

138138
<!-- link to send a test email, if not already sent -->
139139
<li
140-
v-if="testEmailSentId != email.id"
140+
v-if="testEmailSentId !== email.id"
141141
class="me-4 inline cursor-pointer text-blue-500 hover:underline"
142142
@click="sendTest(email)">
143143
{{ $t('Send test') }}
144144
</li>
145145

146146
<!-- text saying that the email has been sent -->
147-
<li v-if="testEmailSentId == email.id" class="me-4 inline">
147+
<li v-if="testEmailSentId === email.id" class="me-4 inline">
148148
{{ $t('Test email sent!') }}
149149
</li>
150150

resources/js/Pages/Settings/Personalize/AddressTypes/Index.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
class="item-list border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800">
9797
<!-- detail of the address type -->
9898
<div
99-
v-if="renameAddressTypeModalShownId != addressType.id"
99+
v-if="renameAddressTypeModalShownId !== addressType.id"
100100
class="flex items-center justify-between px-5 py-2">
101101
<span class="text-base">{{ addressType.name }}</span>
102102

@@ -113,14 +113,14 @@
113113

114114
<!-- rename a addressType modal -->
115115
<form
116-
v-if="renameAddressTypeModalShownId == addressType.id"
116+
v-if="renameAddressTypeModalShownId === addressType.id"
117117
class="item-list border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800"
118118
@submit.prevent="update(addressType)">
119119
<div class="border-b border-gray-200 p-5 dark:border-gray-700">
120120
<errors :errors="form.errors" />
121121

122122
<text-input
123-
:ref="'rename' + addressType.id"
123+
ref="rename"
124124
v-model="form.name"
125125
:label="$t('Name')"
126126
:type="'text'"
@@ -142,7 +142,7 @@
142142

143143
<!-- blank state -->
144144
<div
145-
v-if="localAddressTypes.length == 0"
145+
v-if="localAddressTypes.length === 0"
146146
class="mb-6 rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900">
147147
<p class="p-5 text-center">{{ $t('Address types let you classify contact addresses.') }}</p>
148148
</div>
@@ -201,6 +201,7 @@ export default {
201201
showAddressTypeModal() {
202202
this.form.name = '';
203203
this.createAddressTypeModalShown = true;
204+
this.renameAddressTypeModalShownId = 0;
204205
205206
this.$nextTick(() => {
206207
this.$refs.newAddressType.focus();
@@ -210,9 +211,10 @@ export default {
210211
updateAdressTypeModal(addressType) {
211212
this.form.name = addressType.name;
212213
this.renameAddressTypeModalShownId = addressType.id;
214+
this.createAddressTypeModalShown = false;
213215
214216
this.$nextTick(() => {
215-
this.$refs[`rename${addressType.id}`].focus();
217+
this.$refs.rename[0].focus();
216218
});
217219
},
218220

resources/js/Pages/Settings/Personalize/CallReasons/Index.vue

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<li v-for="callReasonType in localCallReasonTypes" :key="callReasonType.id">
114114
<!-- detail of the call reason type -->
115115
<div
116-
v-if="renameCallReasonTypeModalShownId != callReasonType.id"
116+
v-if="renameCallReasonTypeModalShownId !== callReasonType.id"
117117
class="item-list flex items-center justify-between border-b border-gray-200 px-5 py-2 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800">
118118
<span class="text-base font-semibold">{{ callReasonType.label }}</span>
119119

@@ -132,14 +132,14 @@
132132

133133
<!-- rename a call reason type modal -->
134134
<form
135-
v-if="renameCallReasonTypeModalShownId == callReasonType.id"
135+
v-if="renameCallReasonTypeModalShownId === callReasonType.id"
136136
class="item-list border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800"
137137
@submit.prevent="updateCallReasonType(callReasonType)">
138138
<div class="border-b border-gray-200 p-5 dark:border-gray-700">
139139
<errors :errors="form.errors" />
140140

141141
<text-input
142-
:ref="'rename' + callReasonType.id"
142+
ref="renameCallReasonType"
143143
v-model="form.callReasonTypeName"
144144
:label="$t('Name')"
145145
:type="'text'"
@@ -165,8 +165,9 @@
165165
v-for="reason in callReasonType.reasons"
166166
:key="reason.id"
167167
class="border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800">
168+
{{ reason }}
168169
<!-- detail of the relationship type -->
169-
<div v-if="renameReasonModalId != reason.id" class="flex items-center justify-between px-5 py-2 ps-6">
170+
<div v-if="renameReasonModalId !== reason.id" class="flex items-center justify-between px-5 py-2 ps-6">
170171
<span>{{ reason.label }}</span>
171172

172173
<!-- actions -->
@@ -184,14 +185,14 @@
184185

185186
<!-- rename the reason modal -->
186187
<form
187-
v-if="renameReasonModalId == reason.id"
188+
v-else
188189
class="item-list border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800"
189190
@submit.prevent="updateReason(callReasonType, reason)">
190191
<div class="border-b border-gray-200 p-5 dark:border-gray-700">
191192
<errors :errors="form.errors" />
192193

193194
<text-input
194-
:ref="'rename' + reason.id"
195+
ref="rename"
195196
v-model="form.label"
196197
:label="$t('Name')"
197198
:type="'text'"
@@ -214,7 +215,7 @@
214215

215216
<!-- create a new reason -->
216217
<div
217-
v-if="createReasonModalId != callReasonType.id"
218+
v-if="createReasonModalId !== callReasonType.id"
218219
class="item-list border-b border-gray-200 px-5 py-2 ps-6 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800">
219220
<span
220221
class="cursor-pointer text-sm text-blue-500 hover:underline"
@@ -225,7 +226,7 @@
225226

226227
<!-- create a new resaon -->
227228
<form
228-
v-if="createReasonModalId == callReasonType.id"
229+
v-if="createReasonModalId === callReasonType.id"
229230
class="item-list border-b border-gray-200 hover:bg-slate-50 dark:border-gray-700 dark:bg-slate-900 hover:dark:bg-slate-800"
230231
@submit.prevent="storeReason(callReasonType)">
231232
<div class="border-b border-gray-200 p-5 dark:border-gray-700">
@@ -254,7 +255,7 @@
254255

255256
<!-- blank state -->
256257
<div
257-
v-if="localCallReasonTypes.length == 0"
258+
v-if="localCallReasonTypes.length === 0"
258259
class="mb-6 rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900">
259260
<p class="p-5 text-center">
260261
{{ $t('Call reasons let you indicate the reason of calls you make to your contacts.') }}
@@ -318,6 +319,7 @@ export default {
318319
showCallReasonTypeModal() {
319320
this.form.callReasonTypeName = '';
320321
this.createCallReasonTypeModalShown = true;
322+
this.renameCallReasonTypeModalShownId = 0;
321323
322324
this.$nextTick(() => {
323325
this.$refs.newCallReasonType.focus();
@@ -327,9 +329,10 @@ export default {
327329
renameCallReasonTypeModal(callReasonType) {
328330
this.form.callReasonTypeName = callReasonType.label;
329331
this.renameCallReasonTypeModalShownId = callReasonType.id;
332+
this.createCallReasonTypeModalShown = false;
330333
331334
this.$nextTick(() => {
332-
this.$refs[`rename${callReasonType.id}`].focus();
335+
this.$refs.renameCallReasonType[0].focus();
333336
});
334337
},
335338
@@ -338,7 +341,7 @@ export default {
338341
this.form.label = '';
339342
340343
this.$nextTick(() => {
341-
this.$refs.newReason.focus();
344+
this.$refs.newReason[0].focus();
342345
});
343346
},
344347
@@ -347,7 +350,7 @@ export default {
347350
this.renameReasonModalId = reason.id;
348351
349352
this.$nextTick(() => {
350-
this.$refs[`rename${reason.id}`].focus();
353+
this.$refs.rename[0].focus();
351354
});
352355
},
353356

0 commit comments

Comments
 (0)