Compare commits
6 Commits
cafe030e79
...
e14642ed66
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e14642ed66 | ||
|
|
55afc6bee9 | ||
|
|
0c2aa68311 | ||
|
|
580b022c42 | ||
|
|
dfbeabc93c | ||
|
|
0314076669 |
2
frontend/src/app.d.ts
vendored
2
frontend/src/app.d.ts
vendored
@@ -36,7 +36,7 @@ interface DriversLicence {
|
||||
licence_number: string | "";
|
||||
issued_date: string | "";
|
||||
expiration_date: string | "";
|
||||
issuing_country: string | "";
|
||||
country: string | "";
|
||||
licence_categories: LicenceCategory[];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script>
|
||||
import { quintOut } from "svelte/easing";
|
||||
|
||||
import { t } from "svelte-i18n";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
const modal = (/** @type {Element} */ node, { duration = 300 } = {}) => {
|
||||
@@ -34,7 +35,7 @@
|
||||
>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a
|
||||
title="Close"
|
||||
title={$t("cancel")}
|
||||
class="modal-close"
|
||||
on:click={closeModal}
|
||||
role="button"
|
||||
@@ -52,7 +53,7 @@
|
||||
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
|
||||
/>
|
||||
</svg>
|
||||
<span class="sr-only">Close modal</span>
|
||||
<span class="sr-only">{$t("cancel")}</span>
|
||||
</a>
|
||||
<div class="container">
|
||||
<slot />
|
||||
|
||||
@@ -64,6 +64,8 @@ export default {
|
||||
L: "Land-, Forstwirtschaftsfahrzeuge, Stapler max 40km/h",
|
||||
T: "Land-, Forstwirtschaftsfahrzeuge, Stapler max 60km/h",
|
||||
},
|
||||
cancel: "Abbrechen",
|
||||
confirm: "Bestätigen",
|
||||
licence_categories: "Führerscheinklassen",
|
||||
subscription_model: "Mitgliedschatfsmodell",
|
||||
licence: "Führerschein",
|
||||
|
||||
@@ -58,6 +58,20 @@ export const actions = {
|
||||
bic: String(formData.get("bic")),
|
||||
mandate_reference: String(formData.get("mandate_reference")),
|
||||
},
|
||||
drivers_licence: {
|
||||
id: Number(formData.get("drivers_licence_id")),
|
||||
status: Number(formData.get("licence_status")),
|
||||
licence_number: String(formData.get("licence_number")),
|
||||
issued_date: toRFC3339(formData.get("issued_date")),
|
||||
expiration_date: toRFC3339(formData.get("expiration_date")),
|
||||
country: String(formData.get("country")),
|
||||
licence_categories: formData
|
||||
.getAll("licence_categories[]")
|
||||
.map((category) => ({
|
||||
id: -1, // Use -1 as a placeholder for new categories
|
||||
category: String(category),
|
||||
})),
|
||||
},
|
||||
};
|
||||
|
||||
// Remove undefined or null properties
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
/** @type {App.Locals['licence_categories']} */
|
||||
$: licence_categories = $page.data.licence_categories;
|
||||
|
||||
/** @typedef {{name: string, src: string}} Avatar */
|
||||
const avatarFiles = import.meta.glob("$lib/img/Avatar-*.jpeg", {
|
||||
eager: true,
|
||||
});
|
||||
/** @type{Avatar[]} */
|
||||
let avatars = [];
|
||||
// /** @typedef {{name: string, src: string}} Avatar */
|
||||
// const avatarFiles = import.meta.glob("$lib/img/Avatar-*.jpeg", {
|
||||
// eager: true,
|
||||
// });
|
||||
// /** @type{Avatar[]} */
|
||||
// let avatars = [];
|
||||
|
||||
const TABS = ["profile", "licence", "membership", "bankaccount"];
|
||||
let activeTab = TABS[0];
|
||||
@@ -67,13 +67,13 @@
|
||||
let showModal = false,
|
||||
isUploading = false,
|
||||
isUpdating = false,
|
||||
showAvatars = false,
|
||||
// showAvatars = false,
|
||||
password = "",
|
||||
password2 = "";
|
||||
|
||||
const open = () => (showModal = true);
|
||||
const close = () => (showModal = false);
|
||||
const toggleAvatars = () => (showAvatars = !showAvatars);
|
||||
// const toggleAvatars = () => (showAvatars = !showAvatars);
|
||||
|
||||
$: selectedSubscriptionModel =
|
||||
subscriptions.find(
|
||||
@@ -83,26 +83,26 @@
|
||||
onMount(() => {
|
||||
console.dir(user);
|
||||
console.dir(licence_categories);
|
||||
avatars = Object.entries(avatarFiles).map(([path, module]) => {
|
||||
if (typeof path !== "string") {
|
||||
throw new Error("Unexpected non-string path");
|
||||
}
|
||||
if (
|
||||
typeof module !== "object" ||
|
||||
module === null ||
|
||||
!("default" in module)
|
||||
) {
|
||||
throw new Error("Unexpected module format");
|
||||
}
|
||||
const src = module.default;
|
||||
if (typeof src !== "string") {
|
||||
throw new Error("Unexpected default export type");
|
||||
}
|
||||
return {
|
||||
name: path.split("/").pop()?.split(".")[0] ?? "Unknown",
|
||||
src: src,
|
||||
};
|
||||
});
|
||||
// avatars = Object.entries(avatarFiles).map(([path, module]) => {
|
||||
// if (typeof path !== "string") {
|
||||
// throw new Error("Unexpected non-string path");
|
||||
// }
|
||||
// if (
|
||||
// typeof module !== "object" ||
|
||||
// module === null ||
|
||||
// !("default" in module)
|
||||
// ) {
|
||||
// throw new Error("Unexpected module format");
|
||||
// }
|
||||
// const src = module.default;
|
||||
// if (typeof src !== "string") {
|
||||
// throw new Error("Unexpected default export type");
|
||||
// }
|
||||
// return {
|
||||
// name: path.split("/").pop()?.split(".")[0] ?? "Unknown",
|
||||
// src: src,
|
||||
// };
|
||||
// });
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -126,28 +126,28 @@
|
||||
};
|
||||
|
||||
/** @type {import('./$types').SubmitFunction} */
|
||||
const handleUpload = async () => {
|
||||
isUploading = true;
|
||||
return async ({ result }) => {
|
||||
isUploading = false;
|
||||
/** @type {any} */
|
||||
const res = result;
|
||||
if (result.type === "success" || result.type === "redirect") {
|
||||
user.profile_picture = res.data.profile_picture;
|
||||
}
|
||||
await applyAction(result);
|
||||
};
|
||||
};
|
||||
// const handleUpload = async () => {
|
||||
// isUploading = true;
|
||||
// return async ({ result }) => {
|
||||
// isUploading = false;
|
||||
// /** @type {any} */
|
||||
// const res = result;
|
||||
// if (result.type === "success" || result.type === "redirect") {
|
||||
// user.profile_picture = res.data.profile_picture;
|
||||
// }
|
||||
// await applyAction(result);
|
||||
// };
|
||||
// };
|
||||
</script>
|
||||
|
||||
<div class="hero-container">
|
||||
<div class="hero-logo">
|
||||
<!-- <div class="hero-logo">
|
||||
<img
|
||||
src={user.profile_picture ? user.profile_picture : Avatar}
|
||||
alt={`${user.first_name} ${user.last_name}`}
|
||||
width="200"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="user-info">
|
||||
{#if user.status}
|
||||
<h3 class="hero-subtitle subtitle info-row">
|
||||
@@ -210,7 +210,7 @@
|
||||
|
||||
{#if showModal}
|
||||
<Modal on:close={close}>
|
||||
<div class="avatar-container">
|
||||
<!-- <div class="avatar-container">
|
||||
<form
|
||||
class="avatar-form"
|
||||
action="?/uploadImage"
|
||||
@@ -274,7 +274,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div> -->
|
||||
<form
|
||||
class="content"
|
||||
action="?/updateUser"
|
||||
@@ -445,7 +445,7 @@
|
||||
<InputField
|
||||
name="licence_number"
|
||||
type="text"
|
||||
label={$t("licencce_number")}
|
||||
label={$t("licence_number")}
|
||||
bind:value={user.drivers_licence.licence_number}
|
||||
placeholder={$t("placeholder.licence_number")}
|
||||
toUpperCase={true}
|
||||
@@ -467,7 +467,7 @@
|
||||
<InputField
|
||||
name="country"
|
||||
label={$t("country")}
|
||||
bind:value={user.drivers_licence.issuing_country}
|
||||
bind:value={user.drivers_licence.country}
|
||||
placeholder={$t("placeholder.issuing_country")}
|
||||
/>
|
||||
<div class="licence-categories">
|
||||
@@ -612,10 +612,10 @@
|
||||
{#if isUpdating}
|
||||
<SmallLoader width={30} message={"Aktualisiere..."} />
|
||||
{:else}
|
||||
<button type="button" class="button-dark" on:click={close}
|
||||
>Abbrechen</button
|
||||
<button type="button" class="button-dark" on:click={close}>
|
||||
{$t("cancel")}</button
|
||||
>
|
||||
<button type="submit" class="button-dark">Bestätigen</button>
|
||||
<button type="submit" class="button-dark">{$t("confirm")}</button>
|
||||
{/if}
|
||||
</div>
|
||||
</form>
|
||||
@@ -751,7 +751,7 @@
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
/* .avatar-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@@ -811,7 +811,7 @@
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 50%;
|
||||
}
|
||||
} */
|
||||
.button-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
@@ -143,9 +143,12 @@ func createAdmin(userMail string, subscriptionModelID uint) (*models.User, error
|
||||
SubscriptionModelID: subscriptionModelID,
|
||||
},
|
||||
BankAccount: models.BankAccount{
|
||||
AccountHolderName: "Niemand",
|
||||
Bank: "Keine",
|
||||
IBAN: "DE49700500000008447644", //fake
|
||||
AccountHolderName: "",
|
||||
Bank: "",
|
||||
IBAN: "", //"DE49700500000008447644", //fake
|
||||
},
|
||||
DriversLicence: models.DriversLicence{
|
||||
Status: constants.UnverifiedStatus,
|
||||
},
|
||||
}, nil
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ func (u *User) Safe() map[string]interface{} {
|
||||
"status": u.Status,
|
||||
"id": u.ID,
|
||||
"role_id": u.RoleID,
|
||||
"company": u.Company,
|
||||
"date_of_birth": u.DateOfBirth,
|
||||
"membership": map[string]interface{}{
|
||||
"id": u.Membership.ID,
|
||||
@@ -100,6 +101,7 @@ func (u *User) Safe() map[string]interface{} {
|
||||
},
|
||||
"drivers_licence": map[string]interface{}{
|
||||
"id": u.DriversLicence.ID,
|
||||
"licence_number": u.DriversLicence.LicenceNumber,
|
||||
"status": u.DriversLicence.Status,
|
||||
"issued_date": u.DriversLicence.IssuedDate,
|
||||
"expiration_date": u.DriversLicence.ExpirationDate,
|
||||
|
||||
Reference in New Issue
Block a user