update empty string to null

This commit is contained in:
2025-07-28 18:17:52 +03:00
parent 6d71c60550
commit 462ed2b671
33 changed files with 369 additions and 242 deletions

View File

@@ -7,8 +7,8 @@
<q-btn
rounded color="primary"
class="w100 q-mt-md q-mb-xs"
:disable="!(isFormValid && (isDirty(initialCompany, modelValue)))"
@click = "emit('update')"
:disable="!isFormValid"
@click = "onSubmit"
>
{{ $t(btnText) }}
</q-btn>
@@ -57,10 +57,10 @@
</template>
<script setup lang="ts">
import {onMounted, computed, ref } from 'vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { isDirty } from 'helpers/helpers'
import type { CompanyParams } from 'types/Company'
import { convertEmptyStringsToNull } from 'helpers/helpers'
const { t }= useI18n()
@@ -108,13 +108,11 @@
return Object.values(validations).every(Boolean)
})
const initialCompany = ref({} as CompanyParams)
function onSubmit() {
const cleanedData = convertEmptyStringsToNull(modelValue.value)
emit('update', cleanedData)
}
onMounted(() => {
console.log(111, modelValue.value)
initialCompany.value = { ...modelValue.value }
})
</script>
<style scoped>