Skip to content

Commit

Permalink
key with question and password on client
Browse files Browse the repository at this point in the history
  • Loading branch information
polinaKoroleva05 committed Dec 15, 2024
1 parent 310c242 commit 9748397
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 51 deletions.
102 changes: 52 additions & 50 deletions client/src/components/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,60 @@ export default function Filter(props: { handleSend: any, obj: any, default: any
}
const filters = []
for (let key in props.obj) {
filters.push(
<InputGroup className="mb-3">
<InputGroup.Text id="basic-addon1">{props.obj[key].name}</InputGroup.Text>
{props.obj[key].type == "b" && <InputGroup.Checkbox defaultChecked={props.obj[key].default} name={key} />}
{["s", "select_dynamic"].includes(props.obj[key].type) && <div><Form.Control
placeholder={props.obj[key].name} name={key}
/></div>}
{
props.obj[key].type == "d" && <div><Form.Control type="date"
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control type="date"
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>}
{
props.obj[key].type == "dt" && <div><Form.Control type="datetime-local"
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control type="datetime-local"
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>}
{
props.obj[key].type == "n" && <div><Form.Control type="number"
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control type="number"
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>}
{
props.obj[key].type == "nf" && <div><Form.Control
type="number"
step={0.1}
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control
type="number"
step={0.1}
if (!props.obj[key].noNeedFiltration){
filters.push(
<InputGroup className="mb-3">
<InputGroup.Text id="basic-addon1">{props.obj[key].name}</InputGroup.Text>
{props.obj[key].type == "b" && <InputGroup.Checkbox defaultChecked={props.obj[key].default} name={key} />}
{["s", "select_dynamic"].includes(props.obj[key].type) && <div><Form.Control
placeholder={props.obj[key].name} name={key}
/></div>}
{
props.obj[key].type == "d" && <div><Form.Control type="date"
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control type="date"
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>}
{
props.obj[key].type == "dt" && <div><Form.Control type="datetime-local"
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control type="datetime-local"
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>
}
{
props.obj[key].type == "l" && <Form.Control
placeholder={props.obj[key].name} name={key} pattern="[0-9,]+"
/>
}
{props.obj[key].type == "select_const" && <Form.Select name={key}>{props.obj[key].options.map((role: string) => <option value={role[0]}>{role[1]}</option>)}</Form.Select>}
</InputGroup>
)
/></div>}
{
props.obj[key].type == "n" && <div><Form.Control type="number"
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control type="number"
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>}
{
props.obj[key].type == "nf" && <div><Form.Control
type="number"
step={0.1}
placeholder={props.obj[key].name + ' от'} name={'start' + key}
defaultValue={props.default['start' + key]}
/><Form.Control
type="number"
step={0.1}
placeholder={props.obj[key].name + ' до'} name={'end' + key}
defaultValue={props.default['end' + key]}
/></div>
}
{
props.obj[key].type == "l" && <Form.Control
placeholder={props.obj[key].name} name={key} pattern="[0-9,]+"
/>
}
{props.obj[key].type == "select_const" && <Form.Select name={key}>{props.obj[key].options.map((role: string) => <option value={role[0]}>{role[1]}</option>)}</Form.Select>}
</InputGroup>
)
}

}
return (<>
Expand Down
2 changes: 2 additions & 0 deletions client/src/serviceFiles/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export let usersInit = [{
nameSurnamePatronymic: "Крупская Ольга Дмитриевна",
role: "Client",
login: "LOGIN_1",
password: "123pass",
birthday: "1980-01-13",
regDate: "2024-01-13",
editDate: "2024-01-13",
Expand All @@ -81,6 +82,7 @@ export let usersInit = [{
nameSurnamePatronymic: "Королева Полина Андреевна",
role: "User",
login: "LOGIN_2",
password: "111",
birthday: "2000-01-13",
regDate: "2024-01-13",
editDate: "2024-01-13",
Expand Down
2 changes: 2 additions & 0 deletions client/src/serviceFiles/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type User = {
nameSurnamePatronymic: string,
role: string,
login: string,
password: string,
birthday: string,
regDate: string,
editDate: string,
Expand All @@ -55,6 +56,7 @@ export let userFields = {
nameSurnamePatronymic: { name: "ФИО", type: "s" },
role: { name: "Роль", type: "select_const", options: [["", "Любая"], ["administrator", "Администратор"], ["employee", "Работник"], ["director", "Директор"], ["lord", "Владелец бизнеса"], ["client", "Клиент"]] },
login: { name: "Почта", type: "s" },
password: {name: "Пароль", type: "s", noNeedFiltration: true},
birthday: { name: "Дата рождения", type: "d" },
regDate: { name: "Дата регистрации", type: "dt", noNeedAddition: true },
editDate: { name: "Дата обновления", type: "dt", noNeedAddition: true },
Expand Down
2 changes: 1 addition & 1 deletion server/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public User(string NSP, string role, string login, string psw, string bd)
this.indebtedness = 0;
}

public string _key { get; set; }
public string? _key { get; set; }

public string? nameSurnamePatronymic { get; set; }

Expand Down

0 comments on commit 9748397

Please sign in to comment.