use id for saved points
This commit is contained in:
parent
ac4af66cd5
commit
a1d80eb984
3 changed files with 11 additions and 36 deletions
|
|
@ -71,19 +71,19 @@
|
|||
let startTime = $state(now.toISOString().split("T")[1].split(".")[0]);
|
||||
|
||||
// Coordinate inputs
|
||||
let inputLat = $derived($FlightParametersStore.start_point === "Custom"
|
||||
let inputLat = $derived($FlightParametersStore.start_point === -1
|
||||
? $FlightParametersStore.launch_latitude.toFixed(6)
|
||||
: $SavedPointsStore.find(point => point.name === $FlightParametersStore.start_point)?.lat.toFixed(6) || "0.000000");
|
||||
let inputLng = $derived($FlightParametersStore.start_point === "Custom"
|
||||
: $SavedPointsStore.find(point => point.id === $FlightParametersStore.start_point)?.lat.toFixed(6) || "0.000000");
|
||||
let inputLng = $derived($FlightParametersStore.start_point === -1
|
||||
? $FlightParametersStore.launch_longitude.toFixed(6)
|
||||
: $SavedPointsStore.find(point => point.name === $FlightParametersStore.start_point)?.lon.toFixed(6) || "0.000000");
|
||||
let inputAlt = $derived($FlightParametersStore.start_point === "Custom"
|
||||
: $SavedPointsStore.find(point => point.id === $FlightParametersStore.start_point)?.lon.toFixed(6) || "0.000000");
|
||||
let inputAlt = $derived($FlightParametersStore.start_point === -1
|
||||
? $FlightParametersStore.launch_altitude.toFixed(2)
|
||||
: $SavedPointsStore.find(point => point.name === $FlightParametersStore.start_point)?.alt.toFixed(2) || "0.00");
|
||||
: $SavedPointsStore.find(point => point.id === $FlightParametersStore.start_point)?.alt.toFixed(2) || "0.00");
|
||||
|
||||
function setToCustomOnChange() {
|
||||
if ($FlightParametersStore.start_point !== "Custom") {
|
||||
$FlightParametersStore.start_point = "Custom";
|
||||
if ($FlightParametersStore.start_point !== -1) {
|
||||
$FlightParametersStore.start_point = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,36 +239,11 @@
|
|||
<FormGroup spacing="mb-2">
|
||||
<Label for="startPoint" class="form-label">Точка старта:</Label>
|
||||
<InputGroup size="sm">
|
||||
<!-- <Input
|
||||
type="select"
|
||||
id="startPoint"
|
||||
bind:value={$FlightParametersStore.start_point}
|
||||
>
|
||||
<optgroup label="Сохраненные точки">
|
||||
{#each $SavedPointsStore as point}
|
||||
<option
|
||||
value={point.name}
|
||||
data-lat={point.lat}
|
||||
data-lng={point.lon}
|
||||
data-alt={point.alt}
|
||||
>
|
||||
{point.name}
|
||||
</option>
|
||||
{/each}
|
||||
</optgroup>
|
||||
<optgroup label="Задать вручную">
|
||||
<option value="Custom">Custom</option>
|
||||
</optgroup>
|
||||
</Input>
|
||||
<Button color="secondary" title="Edit Saved Locations" onclick={handleClickPointListModal}>
|
||||
<span>Редакт.</span>
|
||||
<Icon name="journal-bookmark-fill" />
|
||||
</Button> -->
|
||||
<SelectSearchable
|
||||
id="startPoint"
|
||||
bind:selected={$FlightParametersStore.start_point}
|
||||
options={$SavedPointsStore.map(point => ({
|
||||
value: point.name,
|
||||
value: point.id,
|
||||
label: point.name,
|
||||
}))}
|
||||
placeholder="Выберите точку старта"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export const getForecast = async (
|
|||
throw new Error("CSRF token not found");
|
||||
}
|
||||
|
||||
const response = await fetch("http://localhost:8000/api/predictions", {
|
||||
const response = await fetch("http://localhost:8000/api/predictions/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export interface FlightParameters {
|
|||
launch_longitude: number;
|
||||
profile: (typeof PROFILE_MAP)[ProfileName];
|
||||
version: number;
|
||||
start_point?: string; // Optional, used for saved points
|
||||
start_point?: number; // Optional, used for saved points
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue