` 内联): * TripLog 的节点表单有十几组字段(类型/时间/出行方式/交通细节/起终点/内容/ * 参与人/照片/状态),内联在主页面里会把整个详情页撑得极长; * 更要命的是**编辑**时每个行程内联一份表单 → 页面上 N 份表单互相干扰 * (元素 id 撞车、密码管理器逐个扫描变卡)。这正是用户说的"把页面撑破"。 * * 字段顺序照 TripLog 的 nodes/form.php(第 17 批又砍掉了两处冗余): * 类型 → 标题 → 起止时间 → 出行方式(自驾才有车辆)→ 线路/车次/承运方 * → 出发地 → 到达地 → 内容 → 参与人 → 照片 →(编辑时)状态与花销。 * * 变量(require 前设好): * $ev 所属旅程(events 行,带 title) * $n 被编辑的行程;null = 新增 * $stage 'plan'|'actual'(新增时由按钮决定;编辑时取行程自己的) * $people 名册(**只用于弹框组件**,不再平铺成一长串勾选框) * $types 节点类型(NodeType::all) * $vehicles 可挑的车(Vehicle::pickable —— 第 17 批起**只有自家车辆库**) * $expenses 已有花销(编辑时) * $errors 校验错误 */ $isEdit = !empty($n); $canWrite = \App\Auth::canWrite(); $fid = (int)\App\Auth::familyId(); $people = $people ?? []; $types = $types ?? []; $vehicles = $vehicles ?? []; $expenses = $expenses ?? []; $errors = $errors ?? []; $stage = (string)($stage ?? ($n['stage'] ?? 'plan')); if (!isset(\App\Trip::NODE_STAGES[$stage])) { $stage = 'plan'; } $curType = (string)($n['node_type'] ?? ''); $curMode = (string)($n['travel_mode'] ?? ''); $picked = array_map('intval', array_column((array)($n['members'] ?? []), 'id')); $back = url('trips/show', ['id' => (int)$ev['id']]); // 车辆下拉:只有**自驾**才显示(用户第 3 条)。服务端先按已存值决定初始显隐, // 之后由 app.js 里的 data-mode-select 跟着下拉变。 $needsVehicle = \App\Trip::modeNeedsVehicle($curMode); // 车次/航班号:只有火车与飞机才显示(用户第 3 条) $needsTicket = in_array($curMode, \App\Trip::TICKET_MODES, true); // 起终点(编辑时从库里回填;老数据列是 varchar,坐标是 decimal) $fromRow = [ 'name' => (string)($n['from_place'] ?? ''), 'address' => (string)($n['from_addr'] ?? ''), 'lng' => (string)($n['from_lng'] ?? ''), 'lat' => (string)($n['from_lat'] ?? ''), 'city' => (string)($n['from_city'] ?? ''), ]; $toRow = [ 'name' => (string)($n['to_place'] ?? ''), 'address' => (string)($n['to_addr'] ?? ''), 'lng' => (string)($n['to_lng'] ?? ''), 'lat' => (string)($n['to_lat'] ?? ''), 'city' => (string)($n['to_city'] ?? ''), ]; $amap = \App\Geo::jsConfig(); ?>
还没记花销。
合计 = e(\App\Expense::money(\App\Expense::sumOfNode((int)$n['id']))) ?>