Skip to content

Commit 1b452a9

Browse files
authored
Merge pull request #912 from frappe/main-hotfix
2 parents 8c43732 + 8343b87 commit 1b452a9

File tree

10 files changed

+239
-239
lines changed

10 files changed

+239
-239
lines changed

crm/locale/main.pot

Lines changed: 177 additions & 176 deletions
Large diffs are not rendered by default.

frontend/src/components/Modals/CallLogModal.vue

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
<Badge v-if="callLog.isDirty" :label="'Not Saved'" theme="orange" />
1111
</div>
1212
<div class="flex items-center gap-1">
13-
<Button v-if="isManager() && !isMobileView" variant="ghost" class="w-7" @click="openQuickEntryModal">
13+
<Button
14+
v-if="isManager() && !isMobileView"
15+
variant="ghost"
16+
class="w-7"
17+
@click="openQuickEntryModal"
18+
>
1419
<EditIcon class="w-4 h-4" />
1520
</Button>
1621
<Button variant="ghost" class="w-7" @click="show = false">
@@ -19,19 +24,28 @@
1924
</div>
2025
</div>
2126
<div v-if="tabs.data">
22-
<FieldLayout :tabs="tabs.data" :data="_callLog" doctype="CRM Call Log" />
27+
<FieldLayout
28+
:tabs="tabs.data"
29+
:data="callLog.doc"
30+
doctype="CRM Call Log"
31+
/>
2332
<ErrorMessage class="mt-8" :message="error" />
2433
</div>
2534
</div>
2635
<div class="px-4 pt-4 pb-7 sm:px-6">
2736
<div class="space-y-2">
28-
<Button class="w-full" v-for="action in dialogOptions.actions" :key="action.label" v-bind="action"
29-
:label="__(action.label)" :loading="loading" />
37+
<Button
38+
class="w-full"
39+
v-for="action in dialogOptions.actions"
40+
:key="action.label"
41+
v-bind="action"
42+
:label="__(action.label)"
43+
:loading="loading"
44+
/>
3045
</div>
3146
</div>
3247
</template>
3348
</Dialog>
34-
<QuickEntryModal v-if="showQuickEntryModal" v-model="showQuickEntryModal" doctype="CRM Call Log" />
3549
</template>
3650

3751
<script setup>
@@ -54,7 +68,7 @@ const props = defineProps({
5468
options: {
5569
type: Object,
5670
default: {
57-
afterInsert: () => { },
71+
afterInsert: () => {},
5872
},
5973
},
6074
})

frontend/src/components/Modals/OrganizationModal.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
</h3>
1010
</div>
1111
<div class="flex items-center gap-1">
12-
<Button v-if="isManager() && !isMobileView" variant="ghost" class="w-7" @click="openQuickEntryModal">
12+
<Button
13+
v-if="isManager() && !isMobileView"
14+
variant="ghost"
15+
class="w-7"
16+
@click="openQuickEntryModal"
17+
>
1318
<EditIcon class="w-4 h-4" />
1419
</Button>
1520
<Button variant="ghost" class="w-7" @click="show = false">
@@ -27,7 +32,13 @@
2732
</div>
2833
<div class="px-4 pt-4 pb-7 sm:px-6">
2934
<div class="space-y-2">
30-
<Button class="w-full" variant="solid" :label="__('Create')" :loading="loading" @click="createOrganization" />
35+
<Button
36+
class="w-full"
37+
variant="solid"
38+
:label="__('Create')"
39+
:loading="loading"
40+
@click="createOrganization"
41+
/>
3142
</div>
3243
</div>
3344
</template>
@@ -60,7 +71,7 @@ const props = defineProps({
6071
type: Object,
6172
default: {
6273
redirect: true,
63-
afterInsert: () => { },
74+
afterInsert: () => {},
6475
},
6576
},
6677
})
@@ -156,4 +167,4 @@ function openAddressModal(_address) {
156167
}
157168
nextTick(() => (show.value = false))
158169
}
159-
</script>
170+
</script>

frontend/src/components/Settings/ProfileImageEditor.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<FileUploader
33
@success="(file) => setUserImage(file.file_url)"
4-
:validateFile="validateFile"
4+
:validateFile="validateIsImageFile"
55
>
66
<template v-slot="{ file, progress, error, uploading, openFileSelector }">
77
<div class="flex flex-col items-center">
@@ -48,17 +48,11 @@
4848
</template>
4949
<script setup>
5050
import { FileUploader } from 'frappe-ui'
51+
import { validateIsImageFile } from '@/utils';
5152
5253
const profile = defineModel()
5354
5455
function setUserImage(url) {
5556
profile.value.user_image = url
5657
}
57-
58-
function validateFile(file) {
59-
let extn = file.name.split('.').pop().toLowerCase()
60-
if (!['png', 'jpg'].includes(extn)) {
61-
return 'Only PNG and JPG images are allowed'
62-
}
63-
}
6458
</script>

frontend/src/pages/Contact.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="border-b">
1818
<FileUploader
1919
@success="changeContactImage"
20-
:validateFile="validateFile"
20+
:validateFile="validateIsImageFile"
2121
>
2222
<template #default="{ openFileSelector, error }">
2323
<div class="flex flex-col items-start justify-start gap-4 p-5">
@@ -184,7 +184,7 @@ import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
184184
import CameraIcon from '@/components/Icons/CameraIcon.vue'
185185
import DealsIcon from '@/components/Icons/DealsIcon.vue'
186186
import DealsListView from '@/components/ListViews/DealsListView.vue'
187-
import { formatDate, timeAgo } from '@/utils'
187+
import { formatDate, timeAgo, validateIsImageFile } from '@/utils'
188188
import { showAddressModal, addressProps } from '@/composables/modals'
189189
import { getView } from '@/utils/view'
190190
import { getSettings } from '@/stores/settings'
@@ -294,13 +294,6 @@ usePageMeta(() => {
294294
}
295295
})
296296
297-
function validateFile(file) {
298-
let extn = file.name.split('.').pop().toLowerCase()
299-
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
300-
return __('Only PNG and JPG images are allowed')
301-
}
302-
}
303-
304297
async function changeContactImage(file) {
305298
await call('frappe.client.set_value', {
306299
doctype: 'Contact',

frontend/src/pages/Lead.vue

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</div>
7272
<FileUploader
7373
@success="(file) => updateField('image', file.file_url)"
74-
:validateFile="validateFile"
74+
:validateFile="validateIsImageFile"
7575
>
7676
<template #default="{ openFileSelector, error }">
7777
<div class="flex items-center justify-start gap-5 border-b p-5">
@@ -344,7 +344,12 @@ import SidePanelLayout from '@/components/SidePanelLayout.vue'
344344
import FieldLayout from '@/components/FieldLayout/FieldLayout.vue'
345345
import SLASection from '@/components/SLASection.vue'
346346
import CustomActions from '@/components/CustomActions.vue'
347-
import { openWebsite, setupCustomizations, copyToClipboard } from '@/utils'
347+
import {
348+
openWebsite,
349+
setupCustomizations,
350+
copyToClipboard,
351+
validateIsImageFile,
352+
} from '@/utils'
348353
import { showQuickEntryModal, quickEntryProps } from '@/composables/modals'
349354
import { getView } from '@/utils/view'
350355
import { getSettings } from '@/stores/settings'
@@ -575,13 +580,6 @@ watch(tabs, (value) => {
575580
}
576581
})
577582
578-
function validateFile(file) {
579-
let extn = file.name.split('.').pop().toLowerCase()
580-
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
581-
return __('Only PNG and JPG images are allowed')
582-
}
583-
}
584-
585583
const sections = createResource({
586584
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
587585
cache: ['sidePanelSections', 'CRM Lead'],

frontend/src/pages/MobileContact.vue

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
</header>
1212
</LayoutHeader>
1313
<div v-if="contact.data" class="flex flex-col h-full overflow-hidden">
14-
<FileUploader @success="changeContactImage" :validateFile="validateFile">
14+
<FileUploader
15+
@success="changeContactImage"
16+
:validateFile="validateIsImageFile"
17+
>
1518
<template #default="{ openFileSelector, error }">
1619
<div class="flex flex-col items-start justify-start gap-4 p-4">
1720
<div class="flex gap-4 items-center">
@@ -167,7 +170,7 @@ import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
167170
import CameraIcon from '@/components/Icons/CameraIcon.vue'
168171
import DealsIcon from '@/components/Icons/DealsIcon.vue'
169172
import DealsListView from '@/components/ListViews/DealsListView.vue'
170-
import { formatDate, timeAgo } from '@/utils'
173+
import { formatDate, timeAgo, validateIsImageFile } from '@/utils'
171174
import { getView } from '@/utils/view'
172175
import { showAddressModal, addressProps } from '@/composables/modals'
173176
import { getSettings } from '@/stores/settings'
@@ -266,13 +269,6 @@ usePageMeta(() => {
266269
}
267270
})
268271
269-
function validateFile(file) {
270-
let extn = file.name.split('.').pop().toLowerCase()
271-
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
272-
return __('Only PNG and JPG images are allowed')
273-
}
274-
}
275-
276272
async function changeContactImage(file) {
277273
await call('frappe.client.set_value', {
278274
doctype: 'Contact',

frontend/src/pages/MobileOrganization.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div v-if="organization.doc" class="flex flex-col h-full overflow-hidden">
1414
<FileUploader
1515
@success="changeOrganizationImage"
16-
:validateFile="validateFile"
16+
:validateFile="validateIsImageFile"
1717
>
1818
<template #default="{ openFileSelector, error }">
1919
<div class="flex flex-col items-start justify-start gap-4 p-4">
@@ -164,7 +164,7 @@ import { globalStore } from '@/stores/global'
164164
import { usersStore } from '@/stores/users'
165165
import { statusesStore } from '@/stores/statuses'
166166
import { getView } from '@/utils/view'
167-
import { formatDate, timeAgo } from '@/utils'
167+
import { formatDate, timeAgo, validateIsImageFile } from '@/utils'
168168
import {
169169
Breadcrumbs,
170170
Avatar,
@@ -251,13 +251,6 @@ usePageMeta(() => {
251251
}
252252
})
253253
254-
function validateFile(file) {
255-
let extn = file.name.split('.').pop().toLowerCase()
256-
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
257-
return __('Only PNG and JPG images are allowed')
258-
}
259-
}
260-
261254
async function changeOrganizationImage(file) {
262255
await call('frappe.client.set_value', {
263256
doctype: 'CRM Organization',

frontend/src/pages/Organization.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="border-b">
1818
<FileUploader
1919
@success="changeOrganizationImage"
20-
:validateFile="validateFile"
20+
:validateFile="validateIsImageFile"
2121
>
2222
<template #default="{ openFileSelector, error }">
2323
<div class="flex flex-col items-start justify-start gap-4 p-5">
@@ -185,7 +185,7 @@ import { globalStore } from '@/stores/global'
185185
import { usersStore } from '@/stores/users'
186186
import { statusesStore } from '@/stores/statuses'
187187
import { getView } from '@/utils/view'
188-
import { formatDate, timeAgo } from '@/utils'
188+
import { formatDate, timeAgo, validateIsImageFile } from '@/utils'
189189
import {
190190
Tooltip,
191191
Breadcrumbs,
@@ -286,13 +286,6 @@ usePageMeta(() => {
286286
}
287287
})
288288
289-
function validateFile(file) {
290-
let extn = file.name.split('.').pop().toLowerCase()
291-
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
292-
return __('Only PNG and JPG images are allowed')
293-
}
294-
}
295-
296289
async function changeOrganizationImage(file) {
297290
await call('frappe.client.set_value', {
298291
doctype: 'CRM Organization',

frontend/src/utils/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,13 @@ export function isImage(extention) {
394394
)
395395
}
396396

397+
export function validateIsImageFile(file) {
398+
const extn = file.name.split('.').pop().toLowerCase()
399+
if (!isImage(extn)) {
400+
return __('Only image files are allowed')
401+
}
402+
}
403+
397404
export function getRandom(len = 4) {
398405
let text = ''
399406
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'

0 commit comments

Comments
 (0)