Correct calendar deadline export and isolate notification storage
This commit is contained in:
@@ -422,8 +422,9 @@ export const TenderDetailModal = () => {
|
||||
onClick={handleExportICS}
|
||||
className="w-full bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold py-2.5 px-3 rounded-lg text-xs flex items-center justify-center gap-2 border border-slate-300"
|
||||
>
|
||||
<Calendar className="w-4 h-4 text-blue-600" /> Google / Outlook Takvime Ekle
|
||||
<Calendar className="w-4 h-4 text-blue-600" /> Takvim Dosyasını İndir (.ics)
|
||||
</button>
|
||||
<p className="text-xs text-slate-600 mt-2">Bu dosya otomatik güncellenmez. Tarih veya saat değişirse Google/Outlook takviminizdeki eski kaydı güncelleyin; yeni dosyayı içe aktarmak ikinci bir kayıt oluşturabilir.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@ export function tenderDeadline(t) {
|
||||
throw new Error('Geçersiz ihale tarihi veya saati.');
|
||||
return new Date(Date.UTC(Number(year),Number(month)-1,Number(day),hour-3,minute));
|
||||
}
|
||||
const escapeICS = v => String(v || '').replace(/\\/g,'\\\\').replace(/\r?\n/g,'\\n').replace(/;/g,'\\;').replace(/,/g,'\\,');
|
||||
const escapeICS = v => String(v || '').replace(/\\/g,'\\\\').replace(/\r\n|\r|\n/g,'\\n').replace(/;/g,'\\;').replace(/,/g,'\\,');
|
||||
const stamp = date => date.toISOString().replace(/[-:]/g,'').replace(/\.\d{3}Z$/,'Z');
|
||||
function fold(line) {
|
||||
const result = []; let current = '';
|
||||
@@ -31,9 +31,9 @@ export function createTenderICS(t, now = new Date()) {
|
||||
if (!uid) throw new Error('İhale kimliği gerekli.');
|
||||
return ['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//Ihaleist//Tender Calendar//TR','CALSCALE:GREGORIAN',
|
||||
'BEGIN:VEVENT',`UID:${uid}@ihaleist.com`,`DTSTAMP:${stamp(now)}`,
|
||||
`DTSTART:${stamp(start)}`,`DTEND:${stamp(start)}`,
|
||||
`DTSTART:${stamp(start)}`,'TRANSP:TRANSPARENT',
|
||||
`SUMMARY:${escapeICS('İhale son teklif: '+t.baslik)}`,
|
||||
`DESCRIPTION:${escapeICS('İKN: '+t.ikn+' — '+t.kurum)}`,
|
||||
`DESCRIPTION:${escapeICS('İKN: '+t.ikn+' — '+t.kurum+'\nBu tek seferlik takvim kaydı otomatik güncellenmez. İhale tarihini resmi kaynaktan doğrulayın; değişiklikte takviminizdeki eski kaydı güncelleyin.')}`,
|
||||
'END:VEVENT','END:VCALENDAR',''].map(fold).join('\r\n');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user