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