Spaces:
Running
Running
Deploy 7b14487 từ GitHub Actions
Browse filesFiles changed (3)
91 unmodified lines92939495969798384 unmodified lines4834844854864874884894905 unmodified lines49649749849950050150291 unmodified lineselse errors.push('Số ngày lưu trú (1–365)');}const t: TripInfo = {groupCode: str('groupCode', 'Phân tách khách hàng', 60), entryDate, stayDays, multipleEntry: bool('multipleEntry', 'Nhập cảnh nhiều lần'),visaType: str('visaType', 'Cách nhận thị thực'), receivePlace: str('receivePlace', 'Nơi nhận visa'), purpose: str('purpose', 'Mục đích'),vip: bool('vip', 'Vào cửa VIP'), urgent: bool('urgent', 'Khẩn'), authority: str('authority', 'Cơ quan cấp'),direction: str('direction', 'Hướng hành trình'), occupation: str('occupation', 'Nghề nghiệp', 60),384 unmodified linesunder6: rows.filter((r) => r.under6Months).map((r) => ({ id: r.id, batchId: r.batchId, name: r.name, expiryDate: r.expiryDate, entryDate: r.entryDate, expired: r.expired })),groupCodes: [...new Set(entries.map((e) => e.trip.groupCode).filter(Boolean))],entryDates: [...new Set(entries.map((e) => e.trip.entryDate).filter(Boolean))],dvcName: dvcFileName(entries[0]?.trip.groupCode ?? '', entries.length),bpName: bpFileName(entries[0]?.trip.groupCode ?? '', entries.length, entries[0]?.trip.entryDate),});}));api.post('/export/:kind', json, h(async (req, res) => {5 unmodified linesconst bytes = kind === 'dvc'? fillTemplate(template('thong-tin-ho-chieu.xlsx'), 'INF_NHAN_SU', dvcRows(sorted)): fillTemplate(template('cong-van-bp.xlsx'), 'BP', bpRows(sorted));const fallback = kind === 'dvc' ? dvcFileName(entries[0].trip.groupCode ?? '', entries.length) : bpFileName(entries[0].trip.groupCode ?? '', entries.length, entries[0].trip.entryDate);let name = typeof req.body?.filename === 'string' && req.body.filename.trim() ? req.body.filename.trim().replace(/[\\/:*?"<>|]+/g, '').slice(0, 120) : fallback;if (!/\.xlsx$/i.test(name)) name += '.xlsx';res.set({91 unmodified lines92939495969798384 unmodified lines4834844854864874884894905 unmodified lines49649749849950050150250391 unmodified lineselse errors.push('Số ngày lưu trú (1–365)');}const t: TripInfo = {groupCode: str('groupCode', 'Phân tách khách hàng', 60), lotCode: str('lotCode', 'Mã lô', 40), entryDate, stayDays, multipleEntry: bool('multipleEntry', 'Nhập cảnh nhiều lần'),visaType: str('visaType', 'Cách nhận thị thực'), receivePlace: str('receivePlace', 'Nơi nhận visa'), purpose: str('purpose', 'Mục đích'),vip: bool('vip', 'Vào cửa VIP'), urgent: bool('urgent', 'Khẩn'), authority: str('authority', 'Cơ quan cấp'),direction: str('direction', 'Hướng hành trình'), occupation: str('occupation', 'Nghề nghiệp', 60),384 unmodified linesunder6: rows.filter((r) => r.under6Months).map((r) => ({ id: r.id, batchId: r.batchId, name: r.name, expiryDate: r.expiryDate, entryDate: r.entryDate, expired: r.expired })),groupCodes: [...new Set(entries.map((e) => e.trip.groupCode).filter(Boolean))],entryDates: [...new Set(entries.map((e) => e.trip.entryDate).filter(Boolean))],dvcName: dvcFileName(entries[0]?.trip.groupCode ?? '', entries.length, entries[0]?.trip.lotCode),bpName: bpFileName(entries[0]?.trip.groupCode ?? '', entries.length, entries[0]?.trip.entryDate, entries[0]?.trip.lotCode, entries[0]?.trip.receivePlace),});}));api.post('/export/:kind', json, h(async (req, res) => {5 unmodified linesconst bytes = kind === 'dvc'? fillTemplate(template('thong-tin-ho-chieu.xlsx'), 'INF_NHAN_SU', dvcRows(sorted)): fillTemplate(template('cong-van-bp.xlsx'), 'BP', bpRows(sorted));const t0 = entries[0].trip;const fallback = kind === 'dvc' ? dvcFileName(t0.groupCode ?? '', entries.length, t0.lotCode) : bpFileName(t0.groupCode ?? '', entries.length, t0.entryDate, t0.lotCode, t0.receivePlace);let name = typeof req.body?.filename === 'string' && req.body.filename.trim() ? req.body.filename.trim().replace(/[\\/:*?"<>|]+/g, '').slice(0, 120) : fallback;if (!/\.xlsx$/i.test(name)) name += '.xlsx';res.set({
28 unmodified lines29303132333428 unmodified lines</div><div className="grid4"><Field label="Phân tách khách hàng (mã đoàn)"><input value={t.groupCode ?? ''} placeholder="VD: WH3010MC104XE1" onChange={(e) => set({ groupCode: e.target.value.toUpperCase() })} /></Field><Field label="Ngày nhập cảnh" required><DateInput value={t.entryDate ?? ''} onChange={(v) => set({ entryDate: v })} /></Field><Field label="Số ngày lưu trú" required><input type="number" min={1} max={365} value={t.stayDays ?? ''} onChange={(e) => set({ stayDays: Number(e.target.value) || undefined })} /></Field><Field label="Ngày xuất cảnh" hint="(tự tính)"><input className="mono" disabled value={vnDate(exit)} placeholder="dd/mm/yyyy" /></Field>28 unmodified lines2930313233343528 unmodified lines</div><div className="grid4"><Field label="Phân tách khách hàng (mã đoàn)"><input value={t.groupCode ?? ''} placeholder="VD: WH3010MC104XE1" onChange={(e) => set({ groupCode: e.target.value.toUpperCase() })} /></Field><Field label="Mã lô" hint="(tự điền; có thì tên file = mã lô + ngày giờ)"><input value={t.lotCode ?? ''} placeholder="VD: V200" onChange={(e) => set({ lotCode: e.target.value.toUpperCase() })} /></Field><Field label="Ngày nhập cảnh" required><DateInput value={t.entryDate ?? ''} onChange={(v) => set({ entryDate: v })} /></Field><Field label="Số ngày lưu trú" required><input type="number" min={1} max={365} value={t.stayDays ?? ''} onChange={(e) => set({ stayDays: Number(e.target.value) || undefined })} /></Field><Field label="Ngày xuất cảnh" hint="(tự tính)"><input className="mono" disabled value={vnDate(exit)} placeholder="dd/mm/yyyy" /></Field>
12 unmodified lines13141516171815 unmodified lines34353637383940221 unmodified lines26226326426526626726826927027127227327427512 unmodified linesexport interface TripInfo {/** Phân tách khách hàng (mã đoàn), VD WH3010MC104XE1 */groupCode?: string;/** Ngày nhập cảnh YYYY-MM-DD */entryDate?: string;/** Số ngày lưu trú (tính cả ngày nhập cảnh) */15 unmodified linesoccupation?: string;}export const DEFAULT_TRIP: Required<Omit<TripInfo, 'groupCode' | 'entryDate' | 'occupation'>> & TripInfo = {stayDays: 15,multipleEntry: false,visaType: 'Visa rời|12',221 unmodified lines});}/** Tên file theo mẫu: ThongTinHoChieu-<mã đoàn>-<số khách>.xlsx */export function dvcFileName(groupCode: string, n: number): string {return `ThongTinHoChieu-${safeName(groupCode) || 'DOAN'}-${n}.xlsx`;}/** Tên gợi ý cho công văn: "<mã đoàn> CV <số khách>K-NC <dd.mm>" */export function bpFileName(groupCode: string, n: number, entryDate?: string): string {const dm = entryDate ? `${entryDate.slice(8, 10)}.${entryDate.slice(5, 7)}` : '';return `${[safeName(groupCode), 'CV', `${n}K-NC`, dm].filter(Boolean).join(' ')}.xlsx`;}12 unmodified lines131415161718192015 unmodified lines36373839404142221 unmodified lines26426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629712 unmodified linesexport interface TripInfo {/** Phân tách khách hàng (mã đoàn), VD WH3010MC104XE1 */groupCode?: string;/** Mã lô (VD V200); có thì tên file xuất dùng mã lô thay cho mã đoàn */lotCode?: string;/** Ngày nhập cảnh YYYY-MM-DD */entryDate?: string;/** Số ngày lưu trú (tính cả ngày nhập cảnh) */15 unmodified linesoccupation?: string;}export const DEFAULT_TRIP: Required<Omit<TripInfo, 'groupCode' | 'lotCode' | 'entryDate' | 'occupation'>> & TripInfo = {stayDays: 15,multipleEntry: false,visaType: 'Visa rời|12',221 unmodified lines});}/** Mã lô + ngày giờ phút giây (giờ VN): V200-20261116153045 */export function lotStamp(lotCode: string, now = new Date()): string {const vn = new Date(now.getTime() + 7 * 3600_000).toISOString(); // YYYY-MM-DDTHH:mm:ss.sssZreturn `${safeName(lotCode)}-${vn.slice(0, 19).replace(/\D/g, '')}`;}/** Tên file theo mẫu: ThongTinHoChieu-<mã đoàn | mã lô+giờ>-<số khách>.xlsx */export function dvcFileName(groupCode: string, n: number, lotCode?: string, now?: Date): string {const code = lotCode?.trim() ? lotStamp(lotCode, now) : safeName(groupCode);return `ThongTinHoChieu-${code || 'DOAN'}-${n}.xlsx`;}/** Viết tắt 2 chữ của địa danh: "Cửa khẩu Móng Cái" -> "MC" */export function placeAbbr(place: string): string {const name = place.replace(/^(cửa khẩu|cảng hàng không|cảng|sbqt|sân bay quốc tế|sân bay)\s+/i, '');const words = name.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/đ/gi, 'd').split(/[\s.,-]+/).filter(Boolean);return words.slice(0, 2).map((w) => w[0]).join('').toUpperCase();}/*** Tên gợi ý cho công văn.* Có mã lô: "CV <lô>.<n>K-NC <dd.mm> <địa danh>" (VD "CV V200.20K-NC 08.11 MC").* Chưa có: "<mã đoàn> CV <n>K-NC <dd.mm>" như cũ.*/export function bpFileName(groupCode: string, n: number, entryDate?: string, lotCode?: string, receivePlace?: string): string {const dm = entryDate ? `${entryDate.slice(8, 10)}.${entryDate.slice(5, 7)}` : '';const lot = safeName(lotCode ?? '');if (lot) return `${['CV ' + lot + '.' + n + 'K-NC', dm, placeAbbr(receivePlace ?? '')].filter(Boolean).join(' ')}.xlsx`;return `${[safeName(groupCode), 'CV', `${n}K-NC`, dm].filter(Boolean).join(' ')}.xlsx`;}
passport-check/apps/server/src/index.ts+5-4
passport-check/apps/web/src/components/TripForm.tsx+1
passport-check/packages/core/src/visa.ts+28-6