-
-
-
- | Contact |
- Email |
- Phone |
- Date Creation |
- Actions |
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ | Contact |
+ Client |
+ Email |
+ Phone / Mobile |
+ Position |
+ Status |
+ Actions |
+
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Aucun contact trouvé
+
+ Aucun contact à afficher pour le moment.
+
+
-
+
+
diff --git a/thanasoft-front/src/components/molecules/client/SearchInput.vue b/thanasoft-front/src/components/molecules/client/SearchInput.vue
new file mode 100644
index 0000000..f76f974
--- /dev/null
+++ b/thanasoft-front/src/components/molecules/client/SearchInput.vue
@@ -0,0 +1,4 @@
+
+
diff --git a/thanasoft-front/src/components/molecules/form/ContactForm.vue b/thanasoft-front/src/components/molecules/form/ContactForm.vue
new file mode 100644
index 0000000..c65a3d5
--- /dev/null
+++ b/thanasoft-front/src/components/molecules/form/ContactForm.vue
@@ -0,0 +1,623 @@
+
+
+
Nouveau Contact
+
Informations du contact
+
+
+
+
+ Succès ! Contact créé avec succès !
+
+
+
+
+
+
+ {{ fieldErrors.general }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ fieldErrors.client_id }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Aucun client trouvé pour "{{ searchQuery }}"
+
+
+
+
+
+ Sélectionnez un client existant pour associer le contact
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ fieldErrors.first_name }}
+
+
+
+
+
+
+ {{ fieldErrors.last_name }}
+
+
+
+
+
+
+
+
+
+
+ {{ fieldErrors.email }}
+
+
+
+
+
+
+
+
+
+
+ {{ fieldErrors.phone }}
+
+
+
+
+
+
+ {{ fieldErrors.mobile }}
+
+
+
+
+
+
+
+
+
+
+ {{ fieldErrors.role }}
+
+
+
+
+
+
+
+
+
+
+ Attention : Au moins un champ (prénom, nom, email ou
+ téléphone) doit être renseigné.
+
+
+
+
+
+ Réinitialiser
+
+
+
+ {{ props.loading ? "Création..." : "Créer le contact" }}
+
+
+
+
+
+
+
+
+
diff --git a/thanasoft-front/src/components/templates/CRM/contact/ContactDetailTemplate.vue b/thanasoft-front/src/components/templates/CRM/contact/ContactDetailTemplate.vue
new file mode 100644
index 0000000..b6bcc57
--- /dev/null
+++ b/thanasoft-front/src/components/templates/CRM/contact/ContactDetailTemplate.vue
@@ -0,0 +1,11 @@
+
+
+
diff --git a/thanasoft-front/src/components/templates/CRM/contact/NewContactTemplate.vue b/thanasoft-front/src/components/templates/CRM/contact/NewContactTemplate.vue
new file mode 100644
index 0000000..7b1380c
--- /dev/null
+++ b/thanasoft-front/src/components/templates/CRM/contact/NewContactTemplate.vue
@@ -0,0 +1,14 @@
+
+
+
diff --git a/thanasoft-front/src/router/index.js b/thanasoft-front/src/router/index.js
index c7ba61b..b8e75ac 100644
--- a/thanasoft-front/src/router/index.js
+++ b/thanasoft-front/src/router/index.js
@@ -390,6 +390,11 @@ const routes = [
name: "Client details",
component: () => import("@/views/pages/CRM/ClientDetails.vue"),
},
+ {
+ path: "/crm/new-contact",
+ name: "Add Contact",
+ component: () => import("@/views/pages/CRM/AddContact.vue"),
+ },
];
const router = createRouter({
diff --git a/thanasoft-front/src/services/client.ts b/thanasoft-front/src/services/client.ts
index 175f0f0..efc1d3b 100644
--- a/thanasoft-front/src/services/client.ts
+++ b/thanasoft-front/src/services/client.ts
@@ -168,20 +168,23 @@ export const ClientService = {
async searchClients(
query: string,
params?: {
- page?: number;
- per_page?: number;
+ // Remove pagination parameters since we're not using pagination
+ exact_match?: boolean;
}
- ): Promise
{
- const response = await request({
- url: "/api/clients",
+ ): Promise {
+ const response = await request<{
+ data: Client[];
+ count: number;
+ message: string;
+ }>({
+ url: "/api/clients/searchBy",
method: "get",
params: {
- search: query,
- ...params,
+ name: query, // Changed from 'search' to 'name' to match your controller
+ exact_match: params?.exact_match || false,
},
});
-
- return response;
+ return response.data; // Return just the data array
},
/**
diff --git a/thanasoft-front/src/stores/clientStore.ts b/thanasoft-front/src/stores/clientStore.ts
index eaa70d3..00f186a 100644
--- a/thanasoft-front/src/stores/clientStore.ts
+++ b/thanasoft-front/src/stores/clientStore.ts
@@ -15,6 +15,7 @@ export const useClientStore = defineStore("client", () => {
const currentClient = ref(null);
const loading = ref(false);
const error = ref(null);
+ const searchResults = ref([]);
// Pagination state
const pagination = ref({
@@ -61,6 +62,10 @@ export const useClientStore = defineStore("client", () => {
currentClient.value = client;
};
+ const setSearchClient = (searchClient: Client[]) => {
+ searchResults.value = searchClient;
+ };
+
const setPagination = (meta: any) => {
if (meta) {
pagination.value = {
@@ -213,29 +218,20 @@ export const useClientStore = defineStore("client", () => {
/**
* Search clients
*/
- const searchClients = async (
- query: string,
- params?: {
- page?: number;
- per_page?: number;
- }
- ) => {
+ const searchClients = async (query: string, exactMatch: boolean = false) => {
setLoading(true);
- setError(null);
+ error.value = null;
try {
- const response = await ClientService.searchClients(query, params);
- setClients(response.data);
- if (response.meta) {
- setPagination(response.meta);
- }
- return response;
- } catch (err: any) {
- const errorMessage =
- err.response?.data?.message ||
- err.message ||
- "Failed to search clients";
- setError(errorMessage);
+ const results = await ClientService.searchClients(query, {
+ exact_match: exactMatch,
+ });
+ setSearchClient(results);
+ return results;
+ } catch (err) {
+ error.value = "Erreur lors de la recherche des clients";
+ console.error("Error searching clients:", err);
+ setSearchClient([]);
throw err;
} finally {
setLoading(false);
diff --git a/thanasoft-front/src/views/pages/CRM/AddContact.vue b/thanasoft-front/src/views/pages/CRM/AddContact.vue
new file mode 100644
index 0000000..0fd36d7
--- /dev/null
+++ b/thanasoft-front/src/views/pages/CRM/AddContact.vue
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/thanasoft-front/src/views/pages/CRM/Contacts.vue b/thanasoft-front/src/views/pages/CRM/Contacts.vue
index 8a6cb32..eb5d2a9 100644
--- a/thanasoft-front/src/views/pages/CRM/Contacts.vue
+++ b/thanasoft-front/src/views/pages/CRM/Contacts.vue
@@ -1,5 +1,5 @@
-
+