fix: moved create one btn from slot to Link component
This commit is contained in:
parent
c843f68738
commit
10a37c6a54
@ -24,8 +24,19 @@
|
|||||||
<slot name="item-prefix" v-bind="{ active, selected, option }" />
|
<slot name="item-prefix" v-bind="{ active, selected, option }" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="$slots.footer" #footer="{ value, close }">
|
<template v-if="attrs.onCreate" #footer="{ value, close }">
|
||||||
<slot name="footer" v-bind="{ value, close }" />
|
<div>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
class="w-full !justify-start"
|
||||||
|
label="Create one"
|
||||||
|
@click="attrs.onCreate(value, close)"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<FeatherIcon name="plus" class="h-4" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Autocomplete>
|
</Autocomplete>
|
||||||
</div>
|
</div>
|
||||||
@ -34,7 +45,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import Autocomplete from '@/components/frappe-ui/Autocomplete.vue'
|
import Autocomplete from '@/components/frappe-ui/Autocomplete.vue'
|
||||||
import { watchDebounced } from '@vueuse/core'
|
import { watchDebounced } from '@vueuse/core'
|
||||||
import { createResource } from 'frappe-ui'
|
import { createResource, FeatherIcon } from 'frappe-ui'
|
||||||
import { useAttrs, computed, ref } from 'vue'
|
import { useAttrs, computed, ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|||||||
@ -119,6 +119,16 @@
|
|||||||
value=""
|
value=""
|
||||||
doctype="Contact"
|
doctype="Contact"
|
||||||
@change="(e) => addContact(e)"
|
@change="(e) => addContact(e)"
|
||||||
|
:onCreate="
|
||||||
|
(value, close) => {
|
||||||
|
_contact = {
|
||||||
|
first_name: value,
|
||||||
|
company_name: deal.data.organization,
|
||||||
|
}
|
||||||
|
showContactModal = true
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #target="{ togglePopover }">
|
<template #target="{ togglePopover }">
|
||||||
<Button
|
<Button
|
||||||
@ -131,29 +141,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
<template #footer="{ value, close }">
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
class="w-full !justify-start"
|
|
||||||
label="Create one"
|
|
||||||
@click="
|
|
||||||
() => {
|
|
||||||
_contact = {
|
|
||||||
first_name: value,
|
|
||||||
company_name: deal.data.organization,
|
|
||||||
}
|
|
||||||
showContactModal = true
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<FeatherIcon name="plus" class="h-4" />
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -183,25 +170,8 @@
|
|||||||
:doctype="field.doctype"
|
:doctype="field.doctype"
|
||||||
:placeholder="field.placeholder"
|
:placeholder="field.placeholder"
|
||||||
@change="(e) => field.change(e)"
|
@change="(e) => field.change(e)"
|
||||||
>
|
:onCreate="field.create"
|
||||||
<template
|
/>
|
||||||
v-if="field.create"
|
|
||||||
#footer="{ value, close }"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
class="w-full !justify-start"
|
|
||||||
label="Create one"
|
|
||||||
@click="field.create(value, close)"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<FeatherIcon name="plus" class="h-4" />
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</Link>
|
|
||||||
<FormControl
|
<FormControl
|
||||||
v-else-if="field.type === 'date'"
|
v-else-if="field.type === 'date'"
|
||||||
type="date"
|
type="date"
|
||||||
|
|||||||
@ -205,25 +205,8 @@
|
|||||||
:doctype="field.doctype"
|
:doctype="field.doctype"
|
||||||
:placeholder="field.placeholder"
|
:placeholder="field.placeholder"
|
||||||
@change="(e) => field.change(e)"
|
@change="(e) => field.change(e)"
|
||||||
>
|
:onCreate="field.create"
|
||||||
<template
|
/>
|
||||||
v-if="field.create"
|
|
||||||
#footer="{ value, close }"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
class="w-full !justify-start"
|
|
||||||
label="Create one"
|
|
||||||
@click="field.create(value, close)"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<FeatherIcon name="plus" class="h-4" />
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</Link>
|
|
||||||
<FormControl
|
<FormControl
|
||||||
v-else-if="field.type === 'user'"
|
v-else-if="field.type === 'user'"
|
||||||
type="autocomplete"
|
type="autocomplete"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user