generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/resources/js/components/RegularSelect/RegularSelect.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<div class="form-group mb-3"> | ||
<label for="stage-select-select">Move Lead to stage:</label> | ||
<select id="stage-select" class="form-select mt-2" v-model="selectedOption" @change="handleChange"> | ||
<option value="" disabled>Select an option</option> | ||
<option v-for="option in transformOptions" :key="option.id" :value="option.id"> | ||
{{ option.name }} | ||
</option> | ||
</select> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { computed, ref, inject } from 'vue' | ||
import { useI18n } from "vue-i18n"; | ||
const props = defineProps({ | ||
modelId: { | ||
type: Number, | ||
required: false | ||
}, | ||
options: { | ||
type: Array, | ||
required: true | ||
}, | ||
transformOptions: { | ||
type: Boolean, | ||
required: false | ||
}, | ||
selectedOption: { | ||
type: Number, | ||
required: false | ||
} | ||
}) | ||
const data = inject('data') | ||
const selectedOption = ref(props.selectedOption) | ||
const { t } = useI18n(); | ||
const transformOptions = computed(() => { | ||
if(props.transformOptions) { | ||
return props.options.map((option) => { | ||
return { | ||
id: option.id, | ||
name: option.name | ||
} | ||
}) | ||
} | ||
return props.options | ||
}) | ||
const handleChange = async () => { | ||
if (selectedOption.value) { | ||
try { | ||
const response = await axios.post(data.route.leads.leadStageChange.replace(':leadId',props.modelId),{ | ||
stage_id: selectedOption.value | ||
}) | ||
if (response.status === 200) { | ||
window.notyf.open({ | ||
type: "success", | ||
message: t("Lead moved to another stage!"), | ||
duration: "2500", | ||
ripple: true, | ||
position: "bottom right", | ||
dismissible: true, | ||
}); | ||
} | ||
} catch (error) { | ||
console.error('Error fetching data:', error) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters