main file svelte5 update

This commit is contained in:
relaxed 2025-03-30 18:59:46 +05:00
parent f9912a8f92
commit 8e2dd6cbd9

View File

@ -2,7 +2,6 @@
import "$lib/global.css";
import { path } from "@tauri-apps/api";
import Database from "@tauri-apps/plugin-sql";
// import { writeTextFile, BaseDirectory } from "@tauri-apps/plugin-fs";
import ScreenWrap from "$lib/components/ui/ScreenWrap.svelte";
import Dialog from "$lib/components/ui/Dialog.svelte";
@ -11,7 +10,6 @@
import TextInput from "$lib/components/form/TextInput.svelte";
import NumberInput from "$lib/components/form/NumberInput.svelte";
import ItemList from "$lib/components/form/ItemList.svelte";
// import DateInput from "$lib/components/form/DateInput.svelte";
import PhoneInput from "$lib/components/form/PhoneInput.svelte";
import Select from "$lib/components/form/Select.svelte";
@ -25,8 +23,8 @@
import ViewTable from "$lib/components/shorts/ViewTable.svelte";
import TableListShort from "$lib/components/shorts/TableListShort.svelte";
/** @type {Database} */
let db;
/** @type {Database | undefined} */
let db = $state();
async function load_db() {
// dev
@ -166,11 +164,11 @@ CREATE TABLE IF NOT EXISTS IdBuffer (id INTEGER);
};
/** @type {any} */
export let current_item = {};
let { current_item = $bindable({}) } = $props();
let is_item_dialog_open = false;
let is_dialog_item_add = false;
let is_login_requied = false;
let is_item_dialog_open = $state(false);
let is_dialog_item_add = $state(false);
const is_login_requied = false;
/**
* @param {string} access_level
@ -195,7 +193,7 @@ CREATE TABLE IF NOT EXISTS IdBuffer (id INTEGER);
*/
async function check_login(login, passowrd) {
const access_type =
await db.select(`SELECT AccountAccessLevel.name FROM Accounts
await db?.select(`SELECT AccountAccessLevel.name FROM Accounts
JOIN AccountAccessLevel ON AccountAccessLevel.id = Accounts.account_access_level_id
WHERE Accounts.login = "${login}" AND Accounts.password = "${passowrd}";`);
if (access_type.length === 0) {
@ -209,7 +207,7 @@ WHERE Accounts.login = "${login}" AND Accounts.password = "${passowrd}";`);
@param {Array<number>} ar
*/
async function id_buffer(ar) {
await db.execute(`delete from IdBuffer;
await db?.execute(`delete from IdBuffer;
insert into IdBuffer (id) values (${ar.join("), (")});`);
}
</script>
@ -223,29 +221,20 @@ insert into IdBuffer (id) values (${ar.join("), (")});`);
{is_login_requied}
bind:is_item_dialog_open
bind:is_dialog_item_add
bind:current_item
let:current_page
let:current_table
let:current_view
let:is_view_open
let:cur_dialog_name
let:toggle_add_dialog
let:open_item_edit
let:sql_update_short
let:sql_insert_short
let:sql_delete_short
>
bind:current_item>
{#snippet children({ current_page, current_table, current_view, is_view_open, cur_dialog_name, toggle_add_dialog, open_item_edit, sql_update_short, sql_insert_short, sql_delete_short })}
{#if !is_view_open && current_page === "Запросы"}
{#if current_table === "Pizzas"}
{@const cur_cols = ["name", "price"]}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"название"}>
<TextInput bind:value={current_item.name}></TextInput>
</Field>
@ -253,15 +242,11 @@ insert into IdBuffer (id) values (${ar.join("), (")});`);
<Field name={"Ингридиенты"} is_vertical={true}>
<ItemList
bind:value={current_item.ingredients_ids}
item_list_query={db.select("select id, name from Ingredients")}
item_list_query={db?.select("select id, name from Ingredients")}
on_change={async () => {
await id_buffer(current_item.ingredients_ids);
const query = `
select sum(price) as value
from Ingredients
join IdBuffer on IdBuffer.id = Ingredients.id
`;
const price = await db.select(query);
const query = `select sum(price) as value from Ingredients join IdBuffer on IdBuffer.id = Ingredients.id`;
const price = await db?.select(query);
current_item.price = price[0].value;
}}
></ItemList>
@ -280,30 +265,33 @@ join IdBuffer on IdBuffer.id = Ingredients.id
cur_cols,
"returning id",
);
console.log(las_id.lastInsertId);
// console.log(las_id.lastInsertId);
const query = `insert into PizzasIngredientsJoin (pizza_id, ingredient_id) values
${current_item.ingredients_ids.map((el) => "(" + las_id.lastInsertId + "," + el + ")").join(",")}
`;
console.log(query);
await db.execute(query);
${current_item.ingredients_ids.map((el) => "(" + las_id.lastInsertId + "," + el + ")").join(",")}`;
// console.log(query);
await db?.execute(query);
}}
on_save={async () => {
const query = `
delete from PizzasIngredientsJoin where pizza_id = ${current_item.id};
insert into PizzasIngredientsJoin (pizza_id, ingredient_id) values
${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")").join(",")}
`;
await db.execute(query);
${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")").join(",")}`;
await db?.execute(query);
await sql_update_short(current_table, cur_cols);
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
{current_table}
{current_item}
{toggle_add_dialog}
columns={cur_cols}
on_add_click={() => {
current_item = {
id: 0,
@ -311,68 +299,59 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
price: 0,
ingredients_ids: [],
};
}}
columns={cur_cols}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
}}>
{#snippet children({ is_searching, search_query_result })}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={["id", ...cur_cols]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
<Tr
{index}
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index})}
<Tr {index}
on_click={async () => {
const ingredients_ids = await db.select(
const ingredients_ids = await db?.select(
`select ingredient_id from PizzasIngredientsJoin where pizza_id = ${item.id}`,
);
open_item_edit(item);
current_item.ingredients_ids = ingredients_ids.map(
(/** @type {any} */ el) => el.ingredient_id,
);
}}
>
}}>
<Atd {item} names={["id", ...cur_cols]}></Atd>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{:else if current_table === "PizzasIngredientsJoin"}
{@const cur_cols = ["pizza_id", "ingredient_id"]}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"питса"}>
<Select
bind:value={current_item.pizza_id}
query={db.select("select id, name from Pizzas")}
let:vtype
>
<Select query={db?.select("select id, name from Pizzas")} bind:value={current_item.pizza_id}>
{#snippet children({ vtype })}
{vtype.name}
{vtype.id}
{/snippet}
</Select>
</Field>
<Field name={"ингридиент"}>
<Select
bind:value={current_item.ingredient_id}
query={db.select("select id, name from Ingredients")}
let:vtype
>
<Select query={db.select("select id, name from Ingredients")} bind:value={current_item.ingredient_id}>
{#snippet children({ vtype })}
{vtype.name}
{vtype.id}
{/snippet}
</Select>
</Field>
<TableCudButtons
{form}
bind:is_dialog_item_add
<TableCudButtons {form} bind:is_dialog_item_add
on_add={async () => {
await sql_insert_short(current_table, cur_cols);
}}
@ -381,54 +360,56 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
{current_table}
{current_item}
{toggle_add_dialog}
columns={cur_cols}
on_add_click={() => {
current_item = {
id: 0,
pizza_id: null,
ingredient_id: null,
};
}}
columns={cur_cols}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
}}>
{#snippet children({is_searching, search_query_result})}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={["id", "питса", "ингридиент"]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index})}
<Tr {index} on_click={() => open_item_edit(item)}>
<Atd {item} names={["id", ...cur_cols]}></Atd>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{:else if current_table === "Ingredients"}
{@const cur_cols = ["name", "price"]}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"название"}>
<TextInput bind:value={current_item.name}></TextInput>
</Field>
<Field name={"цена"}>
<NumberInput bind:value={current_item.price}></NumberInput>
</Field>
<TableCudButtons
{form}
bind:is_dialog_item_add
<TableCudButtons {form} bind:is_dialog_item_add
on_add={async () => {
await sql_insert_short(current_table, cur_cols);
}}
@ -437,56 +418,60 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
{current_table}
{current_item}
{toggle_add_dialog}
columns={cur_cols}
on_add_click={() => {
current_item = {
id: 0,
name: "",
price: 0,
};
}}
columns={cur_cols}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
}}>
{#snippet children({ is_searching, search_query_result})}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={["id", ...cur_cols]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index})}
<Tr {index} on_click={() => open_item_edit(item)}>
<Atd {item} names={["id", ...cur_cols]}></Atd>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{:else if current_table === "Clients"}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"сотовый"}>
<PhoneInput bind:phone={current_item.phone}></PhoneInput>
</Field>
<Field name={"Имя"}>
<TextInput bind:value={current_item.fname}></TextInput>
</Field>
<Field name={"Фамилия"}>
<TextInput bind:value={current_item.sname}></TextInput>
</Field>
<Field name={"Отчество"}>
<TextInput bind:value={current_item.tname}></TextInput>
</Field>
{@const cur_cols = ["phone", "fname", "sname", "tname"]}
<TableCudButtons
{form}
@ -499,11 +484,14 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
{current_table}
{current_item}
{toggle_add_dialog}
columns={["phone", "fname", "sname", "tname"]}
on_add_click={() => {
current_item = {
id: 0,
@ -512,94 +500,92 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
sname: "",
tname: "",
};
}}
columns={["phone", "fname", "sname", "tname"]}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
}}>
{#snippet children({ is_searching, search_query_result })}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={["id", "сотовый", "фио"]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index })}
<Tr {index} on_click={() => open_item_edit(item)}>
<Atd {item} names={["id", "phone"]}></Atd>
<Td>{item.sname} {item.fname[0]}.{item.tname[0]}</Td>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{:else if current_table === "Requests"}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"Клиент"}>
<Select
bind:value={current_item.client_id}
query={db.select("select id, fname, sname, tname from Clients")}
let:vtype
>
<Select bind:value={current_item.client_id}
query={db?.select("select id, fname, sname, tname from Clients")}>
{#snippet children({ vtype })}
{vtype.id}
{vtype.sname}
{vtype.sname[0]}. {vtype.tname[0]}.
{/snippet}
</Select>
</Field>
<Field name={"Ответсвтенный"}>
<Select
bind:value={current_item.employee_id}
query={db.select("select id, fname, sname, tname from Employees")}
let:vtype
>
<Select bind:value={current_item.employee_id}
query={db?.select("select id, fname, sname, tname from Employees")}>
{#snippet children({ vtype })}
{vtype.id}
{vtype.sname}
{vtype.sname[0]}. {vtype.tname[0]}.
{/snippet}
</Select>
</Field>
{#if !is_dialog_item_add}
<Field name={"Статус"}>
<Select
bind:value={current_item.request_status_id}
query={db.select("select id, name from RequestStatus")}
let:vtype
>
<Select bind:value={current_item.request_status_id}
query={db?.select("select id, name from RequestStatus")}>
{#snippet children({ vtype })}
{vtype.id}
{vtype.name}
{/snippet}
</Select>
</Field>
{/if}
<Field name={"Тип запроса"}>
<Select
bind:value={current_item.request_type_id}
query={db.select("select id, name from RequestType")}
let:vtype
>
<Select bind:value={current_item.request_type_id}
query={db?.select("select id, name from RequestType")}>
{#snippet children({ vtype })}
{vtype.id}
{vtype.name}
{/snippet}
</Select>
</Field>
{#if !is_dialog_item_add}
<h1>Дата начала {current_item.initial_date}</h1>
{/if}
<Field name={"Описание запроса"}>
<TextInput is_input={false} bind:value={current_item.description}
></TextInput>
<TextInput is_input={false} bind:value={current_item.description}></TextInput>
</Field>
{#if !is_dialog_item_add}
<Field name={"Время"}>
<NumberInput
<NumberInput bind:value={current_item.duration}
is_required={false}
is_float={true}
bind:value={current_item.duration}
></NumberInput>
</Field>
{/if}
{@const cur_cols = [
"client_id",
"employee_id",
@ -610,9 +596,7 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
"duration",
]}
<TableCudButtons
{form}
bind:is_dialog_item_add
<TableCudButtons {form} bind:is_dialog_item_add
on_add={async () => {
await sql_insert_short(current_table, [
"client_id",
@ -628,7 +612,9 @@ ${current_item.ingredients_ids.map((el) => "(" + current_item.id + "," + el + ")
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
{current_table}
{current_item}
@ -692,13 +678,10 @@ JOIN Clients on Clients.id = Requests.client_id
JOIN Employees on Employees.id = Requests.employee_id
JOIN RequestStatus on RequestStatus.id = Requests.request_status_id
JOIN RequestType on RequestType.id = Requests.request_type_id
`}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
`}>
{#snippet children({ is_searching, search_query_result})}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={[
"id",
"клиент",
@ -709,51 +692,53 @@ JOIN RequestType on RequestType.id = Requests.request_type_id
// "описание",
"длительность",
]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index})}
<Tr {index} on_click={() => open_item_edit(item)}>
<Td>
{item.id}
</Td>
<Td>
{#await db.select(`select fname, sname, tname from Clients where id = ${item.client_id}`) then data}
{#await db?.select(`select fname, sname, tname from Clients where id = ${item.client_id}`) then data}
{data[0].fname} {data[0].sname[0]}. {data[0].tname[0]}.
{/await}
</Td>
<Td>
{#await db.select(`select id, fname, sname, tname from Employees where id = ${item.employee_id}`) then data}
{#await db?.select(`select id, fname, sname, tname from Employees where id = ${item.employee_id}`) then data}
{data[0].fname} {data[0].sname[0]}. {data[0].tname[0]}.
{/await}
</Td>
<Td>
{#await db.select(`select id, name from RequestStatus where id = ${item.request_status_id}`) then data}
{#await db?.select(`select id, name from RequestStatus where id = ${item.request_status_id}`) then data}
{data[0].name}
{/await}
</Td>
<Td>
{#await db.select(`select id, name from RequestType where id = ${item.request_type_id}`) then data}
{#await db?.select(`select id, name from RequestType where id = ${item.request_type_id}`) then data}
{data[0].name}
{/await}
</Td>
<Atd {item} names={["initial_date", "duration"]}></Atd>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{/if}
{:else if is_view_open}
{#if current_view === "RequestCount"}
<ViewTable
query={db.select(
query={db?.select(
`SELECT 'значение' AS name, COUNT(id) AS value FROM Requests;`,
)}
columns={["name", "aa"]}
names={["name", "value"]}
></ViewTable>
{:else if current_view === "AvgRequestTime"}
<ViewTable
query={db.select(
query={db?.select(
`SELECT 'значение' AS name, AVG(duration) AS value
FROM Requests
WHERE duration NOT NULL;`,
@ -761,9 +746,10 @@ WHERE duration NOT NULL;`,
columns={["name", "value"]}
names={["name", "value"]}
></ViewTable>
{:else if current_view === "StatByType"}
<ViewTable
query={db.select(`
query={db?.select(`
SELECT
RequestType.name AS type_name,
AVG(duration) AS avg_duratino,
@ -781,23 +767,19 @@ GROUP BY request_type_id;
{#if current_page === "Сотрудники"}
{#if current_table === "Employees"}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"Должность"}>
<Select
bind:value={current_item.employee_status_id}
query={db.select("select id, name from EmployeeStatus")}
let:vtype
>
<Select bind:value={current_item.employee_status_id}
query={db?.select("select id, name from EmployeeStatus")}>
{#snippet children({ vtype})}
{vtype.id}
{vtype.name}
{/snippet}
</Select>
</Field>
@ -815,9 +797,7 @@ GROUP BY request_type_id;
{@const cur_cols = ["employee_status_id", "fname", "sname", "tname"]}
<TableCudButtons
{form}
bind:is_dialog_item_add
<TableCudButtons {form} bind:is_dialog_item_add
on_add={async () => {
await sql_insert_short(current_table, cur_cols);
}}
@ -826,6 +806,7 @@ GROUP BY request_type_id;
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
@ -848,60 +829,54 @@ GROUP BY request_type_id;
name: "EmployeeStatus.name",
is_number: false,
},
]}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
]}>
{#snippet children({ is_searching, search_query_result })}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={["id", "должность", "фио"]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index })}
<Tr {index} on_click={() => open_item_edit(item)}>
<Atd {item} names={["id"]}></Atd>
<Td>
{#await db.select(`select name from EmployeeStatus where id = ${item.employee_status_id}`) then data}
{#await db?.select(`select name from EmployeeStatus where id = ${item.employee_status_id}`) then data}
{data[0].name}
{/await}
</Td>
<Td>{item.sname} {item.fname[0]}.{item.tname[0]}</Td>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{:else if current_table === "Accounts"}
<Dialog
bind:is_open={is_item_dialog_open}
name={cur_dialog_name}
let:form
>
<Dialog name={cur_dialog_name} bind:is_open={is_item_dialog_open}>
{#snippet children({ form })}
{#if !is_dialog_item_add}
<h1>id {current_item.id}</h1>
{/if}
<Field name={"Сотрудник"}>
<Select
bind:value={current_item.employee_id}
query={db.select("select id, fname, sname, tname from Employees")}
let:vtype
>
<Select bind:value={current_item.employee_id}
query={db?.select("select id, fname, sname, tname from Employees")}>
{#snippet children({ vtype })}
{vtype.id}
{vtype.fname}
{vtype.sname[0]}. {vtype.tname[0]}.
{/snippet}
</Select>
</Field>
<Field name={"Доступ"}>
<Select
bind:value={current_item.account_access_level_id}
query={db.select("select id, name from AccountAccessLevel")}
let:vtype
>
<Select bind:value={current_item.account_access_level_id}
query={db?.select("select id, name from AccountAccessLevel")}>
{#snippet children({ vtype })}
{vtype.id}
{vtype.name}
{/snippet}
</Select>
</Field>
@ -920,9 +895,7 @@ GROUP BY request_type_id;
"password",
]}
<TableCudButtons
{form}
bind:is_dialog_item_add
<TableCudButtons {form} bind:is_dialog_item_add
on_add={async () => {
await sql_insert_short(current_table, cur_cols);
}}
@ -931,6 +904,7 @@ GROUP BY request_type_id;
}}
on_delete={sql_delete_short}
></TableCudButtons>
{/snippet}
</Dialog>
<TableButtonsWrap
@ -966,34 +940,32 @@ GROUP BY request_type_id;
name: "Employees.tname",
is_number: false,
},
]}
let:is_searching
let:search_query_result
>
<Table
{is_searching}
search_query={db.select(search_query_result)}
]}>
{#snippet children({ is_searching, search_query_result })}
<Table {is_searching}
search_query={db?.select(search_query_result)}
columns={["id", "Сотрудник", "Доступ", "Логин"]}
query={db.select(`select * from ${current_table}`)}
let:item
let:index
>
query={db?.select(`select * from ${current_table}`)}>
{#snippet children({ item, index })}
<Tr {index} on_click={() => open_item_edit(item)}>
<Atd {item} names={["id"]}></Atd>
<Td>
{#await db.select(`select id, fname, sname, tname from Employees where id = ${item.employee_id}`) then data}
{#await db?.select(`select id, fname, sname, tname from Employees where id = ${item.employee_id}`) then data}
{data[0].fname} {data[0].sname[0]}. {data[0].tname[0]}.
{/await}
</Td>
<Td>
{#await db.select(`select name from AccountAccessLevel where id = ${item.account_access_level_id}`) then data}
{#await db?.select(`select name from AccountAccessLevel where id = ${item.account_access_level_id}`) then data}
{data[0].name}
{/await}
</Td>
<Atd {item} names={["login"]}></Atd>
</Tr>
{/snippet}
</Table>
{/snippet}
</TableButtonsWrap>
{:else if current_table === "AccountAccessLevel"}
<TableListShort
{db}
@ -1002,7 +974,7 @@ GROUP BY request_type_id;
bind:is_item_dialog_open
bind:is_dialog_item_add
bind:current_item
query={db.select(`select * from ${current_table}`)}
query={db?.select(`select * from ${current_table}`)}
columns={["id", "name"]}
columns_display={["id", "название"]}
{toggle_add_dialog}
@ -1023,7 +995,7 @@ GROUP BY request_type_id;
bind:is_item_dialog_open
bind:is_dialog_item_add
bind:current_item
query={db.select(`select * from ${current_table}`)}
query={db?.select(`select * from ${current_table}`)}
columns={["id", "name"]}
columns_display={["id", "название"]}
{toggle_add_dialog}
@ -1034,4 +1006,5 @@ GROUP BY request_type_id;
></TableListShort>
{/if}
{/if}
{/snippet}
</ScreenWrap>