Recheck tender deadlines before preparation output delivery
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import {deadlineInfo} from './tenderCalendar.js';
|
||||
|
||||
/** Preparation may be saved, but a current bid needs a verified future deadline. */
|
||||
export function preparationDeadlineProblem(tender, now = new Date()) {
|
||||
const status=String(tender?.durum || '').toLocaleLowerCase('tr-TR');
|
||||
if (/iptal|sonuçlandı|sözleşme imzalandı/.test(status))
|
||||
return 'İhale iptal edilmiş veya sonuçlanmış. Hazır teklif çıktısı oluşturulamaz; taslağınızı kaydedebilirsiniz.';
|
||||
const info=deadlineInfo(tender,now);
|
||||
if (!info.deadline) return 'Son teklif tarihi veya saati doğrulanamadı. Kaynak ilanı kontrol edin; taslağınızı kaydedebilirsiniz.';
|
||||
if (info.expired) return 'Son teklif zamanı geçti. Hazır teklif çıktısı oluşturulamaz; taslağınızı kaydedebilirsiniz.';
|
||||
return null;
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
// Never manufacture a deadline when the source omitted its time.
|
||||
export function tenderDeadline(t) {
|
||||
const source = String(t.aciklama || '');
|
||||
const date = /^(\d{2})\.(\d{2})\.(\d{4})/.exec(String(t.tarih || ''));
|
||||
const date = /^(\d{2})\.(\d{2})\.(\d{4})(?:$|\s)/.exec(String(t.tarih || ''));
|
||||
if (!date) throw new Error('İhale tarihi doğrulanamadı; takvime eklenemedi.');
|
||||
const [,day,month,year] = date;
|
||||
const time = /^(\d{2}):(\d{2})/.exec(String(t.saat || '').trim())
|
||||
const time = /^(\d{2}):(\d{2})(?:$|\s)/.exec(String(t.saat || '').trim())
|
||||
|| new RegExp(`${day}\\.${month}\\.${year}\\s*[-–]?\\s*(\\d{2}):(\\d{2})`).exec(source);
|
||||
if (!time) throw new Error('İhale saati kaynakta bulunamadı; önce tarih ve saati doğrulayın.');
|
||||
const hour = Number(time[1]), minute = Number(time[2]);
|
||||
|
||||
Reference in New Issue
Block a user