update download csv in notification prod
This commit is contained in:
@ -56,3 +56,7 @@ export function deepMerge(obj1: any, obj2: any): any {
|
||||
export function uniqueID(): string {
|
||||
return (Date.now() + Math.floor(Math.random() * 1000)).toString();
|
||||
}
|
||||
|
||||
const baseUrl = import.meta.env?.VITE_BASE_URL || '/';
|
||||
export const TEMPLATE_CSV_URL = `${baseUrl}template_notification.csv`;
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ import { Check, ChevronDown, X } from 'lucide-react';
|
||||
import { initialStateNotification, selectedNotification, validateFormNotification } from './Types';
|
||||
import { useDebounce } from './useDebounce';
|
||||
import Papa from 'papaparse';
|
||||
import { TEMPLATE_CSV_URL } from '@/lib/helpers';
|
||||
|
||||
const API_URL_CUSTOMER = apiConfig.service_customer;
|
||||
const API_URL_NOTIFICATION = apiConfig.service_notification;
|
||||
@ -469,14 +470,27 @@ const AddDialog = () => {
|
||||
<label className="form-label flex items-center gap-1 max-w-56">
|
||||
Upload MSISDN CSV
|
||||
</label>
|
||||
<div className="flex-1 flex flex-col gap-2">
|
||||
<Input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".csv"
|
||||
onChange={handleFileUpload}
|
||||
className="input col-span-6"
|
||||
/>
|
||||
<div className="flex flex-col gap-2 flex-1">
|
||||
{/* Baris upload + button */}
|
||||
<div className="flex items-center gap-3">
|
||||
<Input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".csv"
|
||||
onChange={handleFileUpload}
|
||||
className="input flex-1"
|
||||
/>
|
||||
|
||||
<a
|
||||
href={TEMPLATE_CSV_URL}
|
||||
download
|
||||
className="px-3 py-2 rounded-md bg-blue-600 text-white text-sm font-medium hover:bg-blue-700"
|
||||
>
|
||||
Download Template CSV
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Info file yang sudah diupload */}
|
||||
{uploadedFileName && formField.customer_phone.length > 0 && (
|
||||
<div className="flex items-center gap-2 text-sm text-green-600 bg-green-50 px-3 py-2 rounded-md">
|
||||
<Check className="w-4 h-4" />
|
||||
|
||||
Reference in New Issue
Block a user