fix: course creation form validations

This commit is contained in:
Jannat Patel
2024-02-28 23:42:17 +05:30
parent 60a917e60c
commit 8f504a8043
5 changed files with 139 additions and 51 deletions

View File

@@ -55,7 +55,7 @@
{{ resume.file_name }}
</span>
<span class="text-sm text-gray-500 mt-1">
{{ getFileSize() }}
{{ getFileSize(resume.file_size) }}
</span>
</div>
</div>
@@ -67,7 +67,7 @@
import { Dialog, FileUploader, Button, createResource } from 'frappe-ui'
import { FileText } from 'lucide-vue-next'
import { ref, inject, defineModel } from 'vue'
import { createToast } from '@/utils/'
import { createToast, getFileSize } from '@/utils/'
const resume = ref(null)
const show = defineModel()
@@ -87,16 +87,6 @@ const validateFile = (file) => {
}
}
const getFileSize = () => {
let value = parseInt(resume.value.file_size)
if (value > 1048576) {
return (value / 1048576).toFixed(2) + 'M'
} else if (value > 1024) {
return (value / 1024).toFixed(2) + 'K'
}
return value
}
const jobApplication = createResource({
url: 'frappe.client.insert',
makeParams(values) {

View File

@@ -48,6 +48,7 @@ import { sessionStore } from '@/stores/session'
import { Dropdown } from 'frappe-ui'
import { ChevronDown, LogIn, LogOut, User } from 'lucide-vue-next'
import { useRouter } from 'vue-router'
import { convertToTitleCase } from '../utils'
const router = useRouter()
const props = defineProps({
@@ -94,18 +95,4 @@ const userDropdownOptions = [
},
},
]
function convertToTitleCase(str) {
if (!str) {
return ''
}
return str
.toLowerCase()
.split(' ')
.map(function (word) {
return word.charAt(0).toUpperCase().concat(word.substr(1))
})
.join(' ')
}
</script>