-
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactExportDialog.vue b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactExportDialog.vue
new file mode 100644
index 000000000..d2b57cbb8
--- /dev/null
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactExportDialog.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactImportDialog.vue b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactImportDialog.vue
new file mode 100644
index 000000000..acb8f0f1c
--- /dev/null
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactImportDialog.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue
index 866811ae2..1813f1057 100644
--- a/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue
@@ -3,7 +3,7 @@ import { computed, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { required, email, minLength } from '@vuelidate/validators';
import { useVuelidate } from '@vuelidate/core';
-
+import { splitName } from '@chatwoot/utils';
import countries from 'shared/constants/countries.js';
import Input from 'dashboard/components-next/input/Input.vue';
import ComboBox from 'dashboard/components-next/combobox/ComboBox.vue';
@@ -80,6 +80,8 @@ const validationRules = {
const v$ = useVuelidate(validationRules, state);
+const isFormInvalid = computed(() => v$.value.$invalid);
+
const prepareStateBasedOnProps = () => {
if (props.isNewContact) {
return; // Added to prevent state update for new contact form
@@ -92,8 +94,7 @@ const prepareStateBasedOnProps = () => {
phoneNumber,
additionalAttributes = {},
} = props.contactData || {};
-
- const [firstName = '', lastName = ''] = name.split(' ');
+ const { firstName, lastName } = splitName(name);
const {
description,
companyName,
@@ -203,6 +204,16 @@ const getMessageType = key => {
: 'info';
};
+const handleCountrySelection = value => {
+ const selectedCountry = countries.find(option => option.name === value);
+ state.additionalAttributes.countryCode = selectedCountry?.id || '';
+ emit('update', state);
+};
+
+const resetValidation = () => {
+ v$.value.$reset();
+};
+
watch(() => props.contactData, prepareStateBasedOnProps, {
immediate: true,
deep: true,
@@ -211,6 +222,8 @@ watch(() => props.contactData, prepareStateBasedOnProps, {
// Expose state to parent component for avatar upload
defineExpose({
state,
+ resetValidation,
+ isFormInvalid,
});
@@ -220,7 +233,7 @@ defineExpose({
{{ t('CONTACTS_LAYOUT.CARD.EDIT_DETAILS_FORM.TITLE') }}
-
+
div>button]:!outline-n-weak [&>div>button]:hover:!outline-n-strong [&>div>button]:!bg-n-alpha-black2':
isDetailsView,
}"
- @update:model-value="emit('update', state)"
+ @update:model-value="handleCountrySelection"
/>
+import { ref, computed } from 'vue';
+import { useMapGetter } from 'dashboard/composables/store';
+import { useI18n } from 'vue-i18n';
+
+import Dialog from 'dashboard/components-next/dialog/Dialog.vue';
+import Button from 'dashboard/components-next/button/Button.vue';
+import ContactsForm from 'dashboard/components-next/Contacts/ContactsForm/ContactsForm.vue';
+
+const emit = defineEmits(['create']);
+
+const { t } = useI18n();
+
+const dialogRef = ref(null);
+const contactsFormRef = ref(null);
+const contact = ref(null);
+
+const uiFlags = useMapGetter('contacts/getUIFlags');
+const isCreatingContact = computed(() => uiFlags.value.isCreating);
+
+const createNewContact = contactItem => {
+ contact.value = contactItem;
+};
+
+const handleDialogConfirm = async () => {
+ if (!contact.value) return;
+ emit('create', contact.value);
+};
+
+const closeDialog = () => {
+ dialogRef.value.close();
+};
+
+defineExpose({ dialogRef, contactsFormRef });
+
+
+
+
+
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsForm/CreateSegmentDialog.vue b/app/javascript/dashboard/components-next/Contacts/ContactsForm/CreateSegmentDialog.vue
new file mode 100644
index 000000000..a246c742c
--- /dev/null
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsForm/CreateSegmentDialog.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsForm/DeleteSegmentDialog.vue b/app/javascript/dashboard/components-next/Contacts/ContactsForm/DeleteSegmentDialog.vue
new file mode 100644
index 000000000..60aa0e55e
--- /dev/null
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsForm/DeleteSegmentDialog.vue
@@ -0,0 +1,43 @@
+
+
+
+
+
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue
index 947310a56..802605ec9 100644
--- a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactHeader.vue
@@ -18,10 +18,10 @@ defineProps({
type: String,
required: true,
},
- buttonLabel: {
- type: String,
- required: true,
- },
+ // buttonLabel: {
+ // type: String,
+ // default: '',
+ // },
activeSort: {
type: String,
default: 'last_activity_at',
@@ -30,16 +30,26 @@ defineProps({
type: String,
default: '',
},
+ isSegmentsView: {
+ type: Boolean,
+ default: false,
+ },
+ hasActiveFilters: {
+ type: Boolean,
+ default: false,
+ },
});
const emit = defineEmits([
'search',
'filter',
'update:sort',
- 'message',
+ // 'message',
'add',
'import',
'export',
+ 'createSegment',
+ 'deleteSegment',
]);
@@ -72,11 +82,37 @@ const emit = defineEmits([
-
-
+
+
+
diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactListHeaderWrapper.vue b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactListHeaderWrapper.vue
new file mode 100644
index 000000000..9724d689d
--- /dev/null
+++ b/app/javascript/dashboard/components-next/Contacts/ContactsHeader/ContactListHeaderWrapper.vue
@@ -0,0 +1,276 @@
+
+
+