Skip to content

Menambahkan validasi input item #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions templates/ dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<h1>Selamat Datang, {{ session['username'] }}</h1>
<p>Ini adalah halaman dashboard Anda.</p>
<a href="{{ url_for('create') }}">
<button>Tambah Item</button>
</a>
<a href="{{ url_for('logout') }}">
<button>Logout</button>
</a>
</div>
</body>
</html>
18 changes: 18 additions & 0 deletions templates/ logout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>Logout</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<h1>Apakah Anda yakin ingin logout?</h1>
<form method="POST">
<button type="submit">Logout</button>
</form>
<a href="{{ url_for('dashboard') }}">
<button>Batal</button>
</a>
</div>
</body>
</html>
19 changes: 19 additions & 0 deletions templates/create.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Tambah Item</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<h1>Form Tambah Item</h1>
<form method="POST">
<input type="text" name="item_name" placeholder="Nama Item" required>
<input type="submit" value="Simpan">
</form>
<a href="{{ url_for('dashboard') }}">
<button>Kembali</button>
</a>
</div>
</body>
</html>
17 changes: 17 additions & 0 deletions templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<h1>Login</h1>
<form method="POST">
<input type="text" name="username" placeholder="Username" required><br>
<input type="password" name="password" placeholder="Password" required><br>
<input type="submit" value="Login">
</form>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions templates/success.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Sukses</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<h1>Item berhasil ditambahkan!</h1>
<a href="{{ url_for('dashboard') }}">
<button>Kembali ke Dashboard</button>
</a>
</div>
</body>
</html>
35 changes: 35 additions & 0 deletions docs/uml/class-diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@startuml

class User {
+id: int
+username: str
+email: str
+password: str
}

class RegisterForm {
+username: str
+email: str
+password: str
+submit(): void
}

class LoginForm {
+username: str
+password: str
+submit(): void
}

class Item {
+id: int
+name: str
+description: str
+price: float
+create(): void
}

User "1" --> "*" Item : owns
RegisterForm ..> User : <<uses>>
LoginForm ..> User : <<uses>>

@enduml
13 changes: 13 additions & 0 deletions docs/uml/sequence-create-item.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@startuml sequence-create-item
actor User
participant "Create Item Page" as ItemPage
participant "routes.py" as Route
participant "models.py" as ItemModel

User -> ItemPage : open form
User -> ItemPage : input item data
ItemPage -> Route : POST /create
Route -> ItemModel : save new item
ItemModel --> Route : success
Route --> ItemPage : show confirmation
@enduml
17 changes: 17 additions & 0 deletions docs/uml/sequence-login.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@startuml sequence-login
actor User
participant "Login Page" as LoginPage
participant "routes.py" as Route
participant "models.py" as UserModel

User -> LoginPage : open form
User -> LoginPage : input username & password
LoginPage -> Route : POST /login
Route -> UserModel : validate_user()
UserModel --> Route : user exists or not
alt valid
Route --> LoginPage : redirect to dashboard
else invalid
Route --> LoginPage : show error
end
@enduml
Binary file added out/docs/uml/class-diagram/class-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added out/docs/uml/sequence-login/sequence-login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.