Schedules — กติกา "จุดนี้ = เวลาจุดอ้างอิง ± n นาที"
- ฟิลด์ derive { from_station_id, offset_min } คำนวณที่ ui/partials/schedules.js (ท่อเดียว) รองรับอ้างจุดข้ามทิศ
- จุดย่อยของ "8 other_stop" ใช้ offsets_min จับคู่ตามลำดับ (เช่น ตลาดสามโก้ = ตลาดท่าช้าง +45 นาที)
- เครื่องมือ resource/tools/derive-times.py + ตาราง resource/data/derive-times.csv (--check / --audit ชี้จุดที่ควรตั้งกฎ)
- แยกตารางเป็นรายสาย: scheduleslist/schedules<route_id>.json และ schedules.json เป็นสารบัญ (โหลดแบบ lazy + cache)
- ตรวจจับวันทำงาน/วันหยุด + schema 3 (weekday/holiday → directions) · ไฟล์ข้อมูลเป็น CRLF ทั้งชุด
- ล้างค่าที่ไม่ใช่ HH:MM ที่ฝังใน times (ทำให้ KPI เพี้ยน) + กันค่าหลอกในตัวสรุปเวลา
UI
- หน้ารายละเอียดป้าย/ตารางเวลา ขับเคลื่อนด้วย JSON (stopDetail.init.js) · จุดขึ้นรถประจำทางอื่นๆ รองรับหลายจุดต่อสาย
- #/stops: แสดง 6 ป้ายแรก + ปุ่ม "แสดงป้ายทั้งหมด" (โหลดรูปเฉพาะที่แสดง) · ชิปสาย → #/routes/<route_id>
- หน้าแรก: ตัดตัวเลือก "ทุกสถานีในจังหวัดนี้" · ตัวกรองจังหวัด/สถานี + ปุ่มแชร์ (share URL)
- การ์ดติดต่อ: ไอคอน/ชื่อ/สีเปลี่ยนตามชนิด URL (Facebook / LINE / เว็บไซต์) + ปุ่มเปิดลิงก์จาก web_url
- รูปรองรับหลายนามสกุล (.jpg → .jpeg → .webp → .png) · ป้าย "ประมาณ" + หมายเหตุสำหรับตารางที่คำนวณ
- หน้าเครดิตเหลือ 3 หมวด · แก้ข้อความหมวดแผนที่ให้ตรงกับข้อมูลจริง
- แผนที่ Leaflet (vendor ในโปรเจกต์ ไม่ใช้ CDN): เส้นทาง + หมุด + ป๊อปอัป · แก้ CSS ที่ทำให้ SVG ยุบ 0x0
เครื่องมือและเอกสาร
- qgis-to-web.py อ่าน .shp ตรง → geojson-web (สร้างใหม่ 10 ไฟล์) + audit-geojson.py ตรวจ 3 ส่วน
- stop-km.py วัดระยะ กม. ตามเส้นจริง → stop-km.json · schedules-editor.html (แก้ทีละไฟล์ · มุมมองตารางแบบ Excel)
- AGENTS.md: กติกา derive · offsets_min · นามสกุลรูป · ชิปสาย · หน้ารายละเอียดป้ายมาจากไหน
179 lines
9.2 KiB
HTML
179 lines
9.2 KiB
HTML
<style>
|
||
/* ============================================================
|
||
busDetail (#/routes, #/routes/:id) — หน้ารายละเอียดสายรถ
|
||
รถประจำสาย + ติดต่อผู้ประกอบการ รวมอยู่ในการ์ดเดียว (ขึ้นก่อน)
|
||
============================================================ */
|
||
|
||
.mu-page { padding: 20px 0 48px; }
|
||
|
||
/* --- header --- */
|
||
.mu-breadcrumb { color: #6f7b95; font-size: .88rem; margin: 0 0 12px; }
|
||
.mu-breadcrumb a { color: #7a4cc0; text-decoration: none; font-weight: 600; }
|
||
.mu-page-title {
|
||
display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
|
||
margin: 0 0 16px; font-size: 1.6rem; color: #1f2a44; font-weight: 800; line-height: 1.25;
|
||
}
|
||
.mu-route-chip {
|
||
display: inline-flex; align-items: center; justify-content: center;
|
||
min-width: 54px; height: 54px; padding: 0 16px; border-radius: 14px;
|
||
background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff;
|
||
font-weight: 800; font-size: 1.35rem; flex: none;
|
||
box-shadow: 0 6px 14px rgba(122, 76, 192, .25);
|
||
}
|
||
.mu-toolbar {
|
||
display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
|
||
background: #fff; border: 1px solid #e7e2f6; border-radius: 14px;
|
||
padding: 12px; margin-bottom: 22px;
|
||
box-shadow: 0 8px 20px rgba(63, 43, 94, .06);
|
||
}
|
||
.mu-toolbar select {
|
||
flex: 1; min-width: 180px; min-height: 46px;
|
||
border: 1px solid #dfe6f1; background: linear-gradient(180deg, #fff, #f8fbff);
|
||
border-radius: 10px; padding: 0 12px; font-family: inherit; font-size: .95rem; color: #1f2a44;
|
||
}
|
||
|
||
/* --- รถประจำสาย + ติดต่อ (การ์ดเดียว ขึ้นก่อน) --- */
|
||
.mu-vehicle-card {
|
||
background: #fff;
|
||
border: 1px solid #e7e2f6;
|
||
border-radius: 18px;
|
||
overflow: hidden;
|
||
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
|
||
display: grid;
|
||
grid-template-columns: 1.3fr 1fr;
|
||
margin-bottom: 26px;
|
||
}
|
||
/* ไม่มีรูปรถใน .image/routes/<รหัส>/ → การ์ดไม่เว้นช่องว่าง */
|
||
#route-vehicle-card.no-photo { grid-template-columns: 1fr; }
|
||
#route-vehicle-card.no-photo > .meta { grid-column: 1 / -1; }
|
||
.mu-vehicle-card > img {
|
||
grid-column: 1; width: 100%; height: 100%; min-height: 240px;
|
||
object-fit: cover; display: block;
|
||
}
|
||
.mu-vehicle-card > .meta {
|
||
grid-column: 2; padding: 24px;
|
||
display: flex; flex-direction: column; justify-content: center; gap: 8px;
|
||
}
|
||
.mu-vehicle-card .meta .label {
|
||
margin: 0; font-size: .78rem; font-weight: 700; color: #7a4cc0;
|
||
text-transform: uppercase; letter-spacing: .05em;
|
||
}
|
||
.mu-vehicle-card .meta h2 { margin: 0; font-size: 1.25rem; color: #1f2a44; }
|
||
.mu-vehicle-card .meta p { margin: 0; color: #6f7b95; font-size: .95rem; line-height: 1.6; }
|
||
|
||
/* ติดต่อผู้ประกอบการ — อยู่ใน footer ของการ์ด */
|
||
.mu-vehicle-contact {
|
||
grid-column: 1 / -1;
|
||
display: flex; flex-wrap: wrap; gap: 10px;
|
||
padding: 14px 18px;
|
||
border-top: 1px solid #f0ecf8;
|
||
background: #faf9ff;
|
||
}
|
||
.mu-contact-item {
|
||
flex: 1; min-width: 220px;
|
||
display: flex; align-items: center; gap: 12px;
|
||
padding: 12px 14px;
|
||
border-radius: 12px;
|
||
background: #fff; border: 1px solid #eee;
|
||
text-decoration: none; color: inherit;
|
||
transition: transform .15s ease, box-shadow .15s ease;
|
||
}
|
||
a.mu-contact-item:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20,40,90,.08); }
|
||
.mu-contact-item .ic-wrap {
|
||
width: 42px; height: 42px; flex: none;
|
||
display: flex; align-items: center; justify-content: center;
|
||
border-radius: 12px;
|
||
background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff;
|
||
}
|
||
.mu-contact-item .ic-wrap.tone-green { background: linear-gradient(135deg, #1f8765, #51c39c); }
|
||
.mu-contact-item .ic-wrap.tone-sky { background: linear-gradient(135deg, #1877f2, #4a9bf8); }
|
||
.mu-contact-item .ic-wrap.tone-purple { background: linear-gradient(135deg, #7a4cc0, #a583e0); }
|
||
.mu-contact-item .mu-link-go { flex: 0 0 auto; display: flex; align-items: center; color: #7a4cc0; opacity: .8; }
|
||
.mu-contact-item:hover .mu-link-go { opacity: 1; transform: translateX(2px); }
|
||
.mu-contact-item .ic-wrap svg { width: 22px; height: 22px; }
|
||
.mu-contact-item .txt { flex: 1; min-width: 0; }
|
||
.mu-contact-item .txt strong { display: block; color: #1f2a44; font-size: .98rem; margin-bottom: 2px; }
|
||
.mu-contact-item .txt span { display: block; color: #6f7b95; font-size: .86rem; }
|
||
.mu-qr-img {
|
||
width: 72px; height: 72px; flex: none;
|
||
object-fit: contain; background: #fff;
|
||
border-radius: 10px; padding: 4px; border: 1px solid #eee;
|
||
}
|
||
|
||
/* --- แผนที่ --- */
|
||
.mu-map-card {
|
||
background: #fff;
|
||
border: 1px solid #e7e2f6;
|
||
border-radius: 16px;
|
||
padding: 16px;
|
||
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
|
||
}
|
||
/* (ตัดกฎ .mu-map-card svg เดิมออก — แผนที่ SVG นิ่งถูกแทนด้วย Leaflet
|
||
และกฎนี้ทำให้ SVG ของ Leaflet ยุบเป็น 0x0 จนเส้นทางไม่แสดง) */
|
||
|
||
.mu-summary-grid { gap: 14px; }
|
||
|
||
@media (max-width: 640px) {
|
||
.mu-page-title { font-size: 1.4rem; }
|
||
.mu-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
|
||
.mu-vehicle-card { grid-template-columns: 1fr; }
|
||
.mu-vehicle-card > img { grid-column: 1; min-height: 200px; }
|
||
.mu-vehicle-card > .meta { grid-column: 1; padding: 18px; }
|
||
.mu-vehicle-contact { grid-column: 1; flex-direction: column; }
|
||
.mu-contact-item { min-width: 0; }
|
||
}
|
||
</style>
|
||
|
||
<main class="mu-page">
|
||
<div class="mu-container">
|
||
<p class="mu-breadcrumb"><a href="#/">หน้าแรก</a>/ <span data-i18n="nav.routes">รายละเอียดสายรถ</span></p>
|
||
<h1 class="mu-page-title"><span class="mu-route-chip" id="route-chip"></span> <span id="route-title"></span></h1>
|
||
|
||
<!-- ตัวเลือกสายรถ: เติมจาก resource/data/routes.json (busDetail.init.js) -->
|
||
<form class="mu-toolbar" onsubmit="return false">
|
||
<select aria-label="เลือกสายรถ" id="route-select"></select>
|
||
</form>
|
||
|
||
<!-- ============ รถประจำสาย + ติดต่อผู้ประกอบการ (การ์ดเดียว) ============ -->
|
||
<!-- รูปรถ/คำอธิบาย/QR/เบอร์โทร: เติมจาก resource/data/captions/caption<รหัสสาย>.json + routes.json -->
|
||
<section class="mu-vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ" id="route-vehicle-card">
|
||
<img id="route-vehicle-img" alt="" loading="lazy" decoding="async" hidden>
|
||
<div class="meta">
|
||
<p class="label" data-i18n="route.vehicle">รถบัสประจำสาย</p>
|
||
<h2 id="route-vehicle-title" hidden></h2>
|
||
<p id="route-vehicle-desc" hidden></p>
|
||
</div>
|
||
<div class="mu-vehicle-contact" id="route-contact"></div>
|
||
</section>
|
||
|
||
<!-- ============ สรุปเส้นทาง ============ -->
|
||
<section class="mu-summary" aria-label="สรุปเส้นทาง">
|
||
<div class="mu-container">
|
||
<div class="mu-summary-grid">
|
||
<div class="mu-stat tag-purple"><h3 id="stat-stops">–</h3><p>จุดจอดหลัก</p></div>
|
||
<div class="mu-stat tag-sky"><h3 id="stat-provinces">–</h3><p>จังหวัดที่ผ่าน</p></div>
|
||
<div class="mu-stat tag-mint"><h3 id="stat-trips">–</h3><p>รอบต่อวัน</p></div>
|
||
<div class="mu-stat tag-pink"><h3 id="stat-next">–</h3><p>รอบถัดไป</p></div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- ============ แผนที่เส้นทาง (Leaflet + GeoJSON จาก QGIS) ============ -->
|
||
<section class="mu-zone" aria-label="แผนที่เส้นทาง">
|
||
<div class="mu-zone-head">
|
||
<span class="mu-zone-tag tag-sky" data-i18n="route.mapTitle">เส้นทางเดินรถ</span>
|
||
<p class="mu-zone-desc" data-i18n="route.mapDesc">เส้นทางจริงจากข้อมูล GIS · ป้ายหยุดรถตามเส้นทาง</p>
|
||
</div>
|
||
<div class="mu-map-card">
|
||
<div class="at-map" id="route-map" role="region" aria-label="แผนที่เส้นทางเดินรถ"></div>
|
||
<p class="at-map-caption" id="route-map-caption"></p>
|
||
<div class="at-km-wrap" hidden>
|
||
<h3><span data-i18n="map.alongRoute">จุดจอดตามเส้นทาง (กม. จากต้นทาง)</span></h3>
|
||
<ul id="route-map-list"></ul>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</main>
|
||
|
||
<script src="./partials/busDetail.init.js"></script> |