|
26 | 26 | </div>
|
27 | 27 |
|
28 | 28 | <!-- Link Mail Button -->
|
29 |
| - <button |
30 |
| - type="button" |
31 |
| - class="primary-button" |
32 |
| - @click="$refs.emailAction.openDrawer()" |
33 |
| - > |
34 |
| - @lang('admin::app.mail.view.link-mail') |
35 |
| - </button> |
| 29 | + @if ( |
| 30 | + bouncer()->hasPermission('contacts.persons.create') |
| 31 | + || bouncer()->hasPermission('leads.create') |
| 32 | + || bouncer()->hasPermission('leads.view') |
| 33 | + || bouncer()->hasPermission('contacts.persons.edit') |
| 34 | + ) |
| 35 | + <button |
| 36 | + type="button" |
| 37 | + class="primary-button" |
| 38 | + @click="$refs.emailAction.openDrawer()" |
| 39 | + > |
| 40 | + @lang('admin::app.mail.view.link-mail') |
| 41 | + </button> |
| 42 | + @endif |
36 | 43 | </div>
|
37 | 44 |
|
38 | 45 | <!-- Email List Vue Component -->
|
@@ -568,12 +575,14 @@ class="flex gap-2 p-2 cursor-pointer text-gray-800 transition-colors hover:bg-bl
|
568 | 575 | </ul>
|
569 | 576 |
|
570 | 577 | <!-- Add New Contact Button -->
|
571 |
| - <div |
572 |
| - class="flex items-center gap-2 p-2 border-t border-gray-200 cursor-pointer text-blue-600 transition-colors" |
573 |
| - @click="toggleContactModal" |
574 |
| - > |
575 |
| - <span>+ @lang('admin::app.mail.view.add-new-contact')</span> |
576 |
| - </div> |
| 578 | + @if (bouncer()->hasPermission('contacts.persons.create')) |
| 579 | + <div |
| 580 | + class="flex items-center gap-2 p-2 border-t border-gray-200 cursor-pointer text-blue-600 transition-colors" |
| 581 | + @click="toggleContactModal" |
| 582 | + > |
| 583 | + <span>+ @lang('admin::app.mail.view.add-new-contact')</span> |
| 584 | + </div> |
| 585 | + @endif |
577 | 586 | </div>
|
578 | 587 | </div>
|
579 | 588 | </template>
|
@@ -680,105 +689,109 @@ class="rounded-xl bg-slate-200 px-3 py-1 text-xs font-medium"
|
680 | 689 | </div>
|
681 | 690 | </template>
|
682 | 691 |
|
683 |
| - <template v-else> |
684 |
| - <div |
685 |
| - class="relative" |
686 |
| - ref="lookup" |
687 |
| - > |
688 |
| - <!-- Input Box (Button) --> |
| 692 | + @if (bouncer()->hasPermission('leads.view')) |
| 693 | + <template v-else> |
689 | 694 | <div
|
690 |
| - class="relative inline-block w-full" |
691 |
| - @click="toggle" |
| 695 | + class="relative" |
| 696 | + ref="lookup" |
692 | 697 | >
|
693 |
| - <!-- Input-like div --> |
694 |
| - <div class="w-full bg-white border border-gray-300 rounded-md px-3 py-2 text-gray-700 cursor-pointer"> |
695 |
| - @{{ selectedItem.name ?? '@lang('Search an existing lead')'}} |
696 |
| - </div> |
697 |
| - |
698 |
| - <!-- Arrow down icon --> |
699 |
| - <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"> |
700 |
| - <i class="fas fa-chevron-down text-gray-400"></i> |
| 698 | + <!-- Input Box (Button) --> |
| 699 | + <div |
| 700 | + class="relative inline-block w-full" |
| 701 | + @click="toggle" |
| 702 | + > |
| 703 | + <!-- Input-like div --> |
| 704 | + <div class="w-full bg-white border border-gray-300 rounded-md px-3 py-2 text-gray-700 cursor-pointer"> |
| 705 | + @{{ selectedItem.name ?? '@lang('Search an existing lead')'}} |
| 706 | + </div> |
| 707 | + |
| 708 | + <!-- Arrow down icon --> |
| 709 | + <div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"> |
| 710 | + <i class="fas fa-chevron-down text-gray-400"></i> |
| 711 | + </div> |
701 | 712 | </div>
|
702 |
| - </div> |
703 | 713 |
|
704 |
| - <!-- toggle popup --> |
705 |
| - <span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"> |
706 |
| - <div class="flex items-center justify-center space-x-1"> |
707 |
| - <i |
708 |
| - class="text-2xl" |
709 |
| - :class="showPopup ? 'icon-up-arrow': 'icon-down-arrow'" |
710 |
| - ></i> |
711 |
| - </div> |
712 |
| - </span> |
| 714 | + <!-- toggle popup --> |
| 715 | + <span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"> |
| 716 | + <div class="flex items-center justify-center space-x-1"> |
| 717 | + <i |
| 718 | + class="text-2xl" |
| 719 | + :class="showPopup ? 'icon-up-arrow': 'icon-down-arrow'" |
| 720 | + ></i> |
| 721 | + </div> |
| 722 | + </span> |
713 | 723 |
|
714 |
| - <!-- Popup Box --> |
715 |
| - <div |
716 |
| - v-if="showPopup" |
717 |
| - class="flex flex-col gap-2 absolute top-full z-10 mt-1 w-full origin-top transform rounded-lg border bg-white p-2 shadow-lg transition-transform" |
718 |
| - > |
719 |
| - <!-- Search Bar --> |
720 |
| - <div class="relative"> |
721 |
| - <!-- Input Box --> |
722 |
| - <input |
723 |
| - type="text" |
724 |
| - v-model.lazy="searchTerm" |
725 |
| - v-debounce="500" |
726 |
| - class="w-full rounded border border-gray-200 px-2.5 py-2 text-sm font-normal text-gray-800 transition-all hover:border-gray-400 focus:border-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:hover:border-gray-400 dark:focus:border-gray-400 pr-10" |
727 |
| - placeholder="@lang('admin::app.mail.view.search')" |
728 |
| - ref="searchInput" |
729 |
| - @keyup="search" |
730 |
| - /> |
731 |
| - |
732 |
| - <!-- Search Icon (absolute positioned) --> |
733 |
| - <span class="absolute inset-y-0 right-0 flex items-center pr-3"> |
734 |
| - <div class="flex items-center justify-center space-x-1"> |
735 |
| - <!-- Loader (optional, based on condition) --> |
736 |
| - <div |
737 |
| - class="relative" |
738 |
| - v-if="isSearching" |
739 |
| - > |
740 |
| - <x-admin::spinner /> |
| 724 | + <!-- Popup Box --> |
| 725 | + <div |
| 726 | + v-if="showPopup" |
| 727 | + class="flex flex-col gap-2 absolute top-full z-10 mt-1 w-full origin-top transform rounded-lg border bg-white p-2 shadow-lg transition-transform" |
| 728 | + > |
| 729 | + <!-- Search Bar --> |
| 730 | + <div class="relative"> |
| 731 | + <!-- Input Box --> |
| 732 | + <input |
| 733 | + type="text" |
| 734 | + v-model.lazy="searchTerm" |
| 735 | + v-debounce="500" |
| 736 | + class="w-full rounded border border-gray-200 px-2.5 py-2 text-sm font-normal text-gray-800 transition-all hover:border-gray-400 focus:border-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:hover:border-gray-400 dark:focus:border-gray-400 pr-10" |
| 737 | + placeholder="@lang('admin::app.mail.view.search')" |
| 738 | + ref="searchInput" |
| 739 | + @keyup="search" |
| 740 | + /> |
| 741 | + |
| 742 | + <!-- Search Icon (absolute positioned) --> |
| 743 | + <span class="absolute inset-y-0 right-0 flex items-center pr-3"> |
| 744 | + <div class="flex items-center justify-center space-x-1"> |
| 745 | + <!-- Loader (optional, based on condition) --> |
| 746 | + <div |
| 747 | + class="relative" |
| 748 | + v-if="isSearching" |
| 749 | + > |
| 750 | + <x-admin::spinner /> |
| 751 | + </div> |
| 752 | + |
| 753 | + <!-- Search Icon --> |
| 754 | + <i class="fas fa-search text-gray-500"></i> |
741 | 755 | </div>
|
742 |
| - |
743 |
| - <!-- Search Icon --> |
744 |
| - <i class="fas fa-search text-gray-500"></i> |
745 |
| - </div> |
746 |
| - </span> |
747 |
| - </div> |
| 756 | + </span> |
| 757 | + </div> |
748 | 758 |
|
749 |
| - <!-- Results List --> |
750 |
| - <ul class="max-h-40 divide-y divide-gray-100 overflow-y-auto"> |
751 |
| - <li |
752 |
| - v-for="lead in leads" |
753 |
| - :key="lead.id" |
754 |
| - class="flex items-center gap-2 p-2 cursor-pointer text-gray-800 transition-colors hover:bg-blue-100" |
755 |
| - @click="linkLead(lead)" |
756 |
| - > |
757 |
| - <div class="flex h-9 w-9 items-center justify-center rounded-full bg-green-200 text-xs font-medium"> |
758 |
| - @{{ lead.title.split(' ').map(word => word[0]).join('') }} |
759 |
| - </div> |
760 |
| - |
761 |
| - <!-- Lead Title --> |
762 |
| - <div class="flex flex-col gap-1"> |
763 |
| - <span>@{{ lead.title }}</span> |
764 |
| - </div> |
765 |
| - </li> |
766 |
| - |
767 |
| - <li v-if="leads.length === 0" class="px-4 py-2 text-center text-gray-500"> |
768 |
| - @lang('admin::app.mail.view.no-result-found') |
769 |
| - </li> |
770 |
| - </ul> |
| 759 | + <!-- Results List --> |
| 760 | + <ul class="max-h-40 divide-y divide-gray-100 overflow-y-auto"> |
| 761 | + <li |
| 762 | + v-for="lead in leads" |
| 763 | + :key="lead.id" |
| 764 | + class="flex items-center gap-2 p-2 cursor-pointer text-gray-800 transition-colors hover:bg-blue-100" |
| 765 | + @click="linkLead(lead)" |
| 766 | + > |
| 767 | + <div class="flex h-9 w-9 items-center justify-center rounded-full bg-green-200 text-xs font-medium"> |
| 768 | + @{{ lead.title.split(' ').map(word => word[0]).join('') }} |
| 769 | + </div> |
| 770 | + |
| 771 | + <!-- Lead Title --> |
| 772 | + <div class="flex flex-col gap-1"> |
| 773 | + <span>@{{ lead.title }}</span> |
| 774 | + </div> |
| 775 | + </li> |
| 776 | + |
| 777 | + <li v-if="leads.length === 0" class="px-4 py-2 text-center text-gray-500"> |
| 778 | + @lang('admin::app.mail.view.no-result-found') |
| 779 | + </li> |
| 780 | + </ul> |
771 | 781 |
|
772 |
| - <!-- Add New Lead Button --> |
773 |
| - <div |
774 |
| - class="flex items-center gap-2 p-2 border-t border-gray-200 cursor-pointer text-blue-600 transition-colors" |
775 |
| - @click="toggleLeadModal" |
776 |
| - > |
777 |
| - <span>+ @lang('admin::app.mail.view.add-new-lead')</span> |
| 782 | + <!-- Add New Lead Button --> |
| 783 | + @if (bouncer()->hasPermission('leads.create')) |
| 784 | + <div |
| 785 | + class="flex items-center gap-2 p-2 border-t border-gray-200 cursor-pointer text-blue-600 transition-colors" |
| 786 | + @click="toggleLeadModal" |
| 787 | + > |
| 788 | + <span>+ @lang('admin::app.mail.view.add-new-lead')</span> |
| 789 | + </div> |
| 790 | + @endif |
778 | 791 | </div>
|
779 | 792 | </div>
|
780 |
| - </div> |
781 |
| - </template> |
| 793 | + </template> |
| 794 | + @endif |
782 | 795 | </div>
|
783 | 796 | </script>
|
784 | 797 |
|
@@ -992,37 +1005,48 @@ class="primary-button"
|
992 | 1005 |
|
993 | 1006 | <x-slot:content class="p-3.5">
|
994 | 1007 | <div class="flex flex-col gap-4">
|
995 |
| - <!-- Link to contact --> |
996 |
| - <label class="font-semibold text-gray-700 cursor-pointer"> |
997 |
| - @{{ email?.person ? "@lang('admin::app.mail.view.linked-contact')" : "@lang('admin::app.mail.view.link-to-contact')" }} |
998 |
| - </label> |
999 |
| - |
1000 | 1008 | <!-- Contact Lookup -->
|
1001 |
| - <v-contact-lookup |
1002 |
| - @link-contact="linkContact" |
1003 |
| - @unlink-contact="unlinkContact" |
1004 |
| - @open-contact-modal="openContactModal" |
1005 |
| - :unlinking="unlinking" |
1006 |
| - :email="email" |
1007 |
| - :tag-text-color="tagTextColor" |
1008 |
| - :background-colors="backgroundColors" |
1009 |
| - ></v-contact-lookup> |
1010 |
| -
|
1011 |
| - <!-- Link to Lead --> |
1012 |
| - <label class="font-semibold text-gray-700 cursor-pointer"> |
1013 |
| - @{{ email?.lead ? "@lang('admin::app.mail.view.linked-lead')" : "@lang('admin::app.mail.view.link-to-lead')" }} |
1014 |
| - </label> |
1015 |
| - |
| 1009 | + @if ( |
| 1010 | + bouncer()->hasPermission('contacts.persons.create') |
| 1011 | + || bouncer()->hasPermission('contacts.persons.edit') |
| 1012 | + ) |
| 1013 | + <!-- Link to contact --> |
| 1014 | + <label class="font-semibold text-gray-700 cursor-pointer"> |
| 1015 | + @{{ email?.person ? "@lang('admin::app.mail.view.linked-contact')" : "@lang('admin::app.mail.view.link-to-contact')" }} |
| 1016 | + </label> |
| 1017 | +
|
| 1018 | + <v-contact-lookup |
| 1019 | + @link-contact="linkContact" |
| 1020 | + @unlink-contact="unlinkContact" |
| 1021 | + @open-contact-modal="openContactModal" |
| 1022 | + :unlinking="unlinking" |
| 1023 | + :email="email" |
| 1024 | + :tag-text-color="tagTextColor" |
| 1025 | + :background-colors="backgroundColors" |
| 1026 | + ></v-contact-lookup> |
| 1027 | + @endif |
| 1028 | +
|
| 1029 | + |
1016 | 1030 | <!-- Lead Lookup -->
|
1017 |
| - <v-lead-lookup |
1018 |
| - @link-lead="linkLead" |
1019 |
| - @unlink-lead="unlinkLead" |
1020 |
| - @open-lead-modal="openLeadModal" |
1021 |
| - :unlinking="unlinking" |
1022 |
| - :email="email" |
1023 |
| - :tag-text-color="tagTextColor" |
1024 |
| - :background-colors="backgroundColors" |
1025 |
| - ></v-lead-lookup> |
| 1031 | + @if ( |
| 1032 | + bouncer()->hasPermission('leads.view') |
| 1033 | + || bouncer()->hasPermission('leads.create') |
| 1034 | + ) |
| 1035 | + <!-- Link to Lead --> |
| 1036 | + <label class="font-semibold text-gray-700 cursor-pointer"> |
| 1037 | + @{{ email?.lead ? "@lang('admin::app.mail.view.linked-lead')" : "@lang('admin::app.mail.view.link-to-lead')" }} |
| 1038 | + </label> |
| 1039 | + |
| 1040 | + <v-lead-lookup |
| 1041 | + @link-lead="linkLead" |
| 1042 | + @unlink-lead="unlinkLead" |
| 1043 | + @open-lead-modal="openLeadModal" |
| 1044 | + :unlinking="unlinking" |
| 1045 | + :email="email" |
| 1046 | + :tag-text-color="tagTextColor" |
| 1047 | + :background-colors="backgroundColors" |
| 1048 | + ></v-lead-lookup> |
| 1049 | + @endif |
1026 | 1050 | </div>
|
1027 | 1051 | </x-slot>
|
1028 | 1052 | </x-admin::drawer>
|
|
0 commit comments