update add manage notification
This commit is contained in:
@ -26,7 +26,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { useManageNotificationContext } from '../hooks/useManageNotificationContext';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
import { CustomerProps } from '@/pages/master/provider/blocks/AddDialog';
|
||||
import { ChevronDown } from 'lucide-react';
|
||||
import { Check, ChevronDown } from 'lucide-react';
|
||||
|
||||
const API_URL_CUSTOMER = apiConfig.service_customer;
|
||||
const API_URL_NOTIFICATION = apiConfig.service_notification;
|
||||
@ -225,26 +225,33 @@ const AddDialog = () => {
|
||||
>
|
||||
<CommandEmpty>No Customer found.</CommandEmpty>
|
||||
<CommandGroup>
|
||||
{customers.map((customer) => (
|
||||
<CommandItem
|
||||
key={customer.id}
|
||||
value={customer.username}
|
||||
onSelect={() => {
|
||||
const customerId = customer.id;
|
||||
setFormField((prev) => {
|
||||
const isSelected = prev.customers.includes(customerId);
|
||||
return {
|
||||
...prev,
|
||||
customers: isSelected
|
||||
? prev.customers.filter((id) => id !== customerId)
|
||||
: [...prev.customers, customerId]
|
||||
};
|
||||
});
|
||||
}}
|
||||
>
|
||||
{customer.username}
|
||||
</CommandItem>
|
||||
))}
|
||||
{customers.map((customer) => {
|
||||
const isSelected = formField.customers.includes(customer.id);
|
||||
return (
|
||||
<CommandItem
|
||||
key={customer.id}
|
||||
value={customer.username}
|
||||
onSelect={() => {
|
||||
const customerId = customer.id;
|
||||
setFormField((prev) => {
|
||||
const isSelected = prev.customers.includes(customerId);
|
||||
return {
|
||||
...prev,
|
||||
customers: isSelected
|
||||
? prev.customers.filter((id) => id !== customerId)
|
||||
: [...prev.customers, customerId]
|
||||
};
|
||||
});
|
||||
}}
|
||||
className={isSelected ? 'bg-accent font-semibold' : ''}
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
{isSelected && <Check className="w-4 h-4 text-green-600" />}
|
||||
{customer.username}
|
||||
</span>
|
||||
</CommandItem>
|
||||
);
|
||||
})}
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</Command>
|
||||
|
||||
Reference in New Issue
Block a user