Skip to content

Commit

Permalink
add ed project inventarisku
Browse files Browse the repository at this point in the history
  • Loading branch information
shafygunawan committed Sep 17, 2024
1 parent f49a62c commit 2afe088
Show file tree
Hide file tree
Showing 68 changed files with 13,339 additions and 1 deletion.
75 changes: 74 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# inventarisku
# InventarisKu

Website sistem inventaris toko.

## Fitur

### Admin & Pegawai

- [x] Login
- [x] Logout
- [x] Dashboard
- [x] Transaksi keluar - daftar
- [x] Transaksi keluar - tambah
- [x] Transaksi keluar - detail
- [x] Transaksi keluar - hapus
- [x] Transaksi masuk - daftar
- [x] Transaksi masuk - tambah
- [x] Transaksi masuk - detail
- [x] Transaksi masuk - hapus
- [x] Barang - daftar
- [x] Barang - tambah
- [x] Barang - edit
- [x] Barang - hapus
- [x] Log aktivitas
- [x] Profil - edit
- [x] Profil - ubah password

### Admin

- [x] Barang - rekalkulasi
- [x] Laporan - barang terlaris
- [x] Laporan - stok barang
- [x] Laporan - user aktif/tidak aktif
- [x] User - daftar
- [x] User - tambah
- [x] User - edit
- [x] User - hapus
- [x] User - ubah password

## Instalasi

Berikut adalah langkah-langkah untuk instalasi website InventarisKu:

1. Buat sebuah database.
2. Import `schema.sql` ke database yang telah dibuat untuk membuat skema database atau tabel-tabel yang dibutuhkan oleh website ini.
3. Import `data.sql` ke database yang dibuat untuk mengisi data-data sementara ke dalam database.
4. Isi konfigurasi website InventarisKu di file-file yang terletak pada folder `config` (`app.php` dan `db.php`).
5. Akses website melalui web browser. Enjoy!!!

## Struktur File & Folder

- `assets`: Berisi file-file aset (css, js, img, dll).
- `config`: Berisi konfigurasi-konfigurasi untuk website InventarisKu.
- `guards`: Berisi file-file yang memiliki fungsi mirip middleware untuk autentikasi dan otorisasi sebuah halaman.
- `helpers`: Berisi file-file fungsi untuk membantu saat pengembangan website.
- `in`: Berisi file-file untuk pengelolaan tabel `in_h` dan `in_d` (`index.php`: daftar, `add.php`: tambah, dan `details.php`: edit).
- `items`: Berisi file-file untuk pengelolaan tabel `items` (`index.php`: daftar, `add.php`: tambah, `details.php`: edit, dan `recalculation.php`: rekalkulasi).
- `out`: Berisi file-file untuk pengelolaan tabel `out_h` dan `out_d` (`index.php`: daftar, `add.php`: tambah, dan `details.php`: edit).
- `partials`: Berisi potongan-potongan atau komponen tampilan website.
- `profile`: Berisi file-file untuk pengelolaan profil (`index.php`: edit dan `change-password.php`: ubah password)
- `reports`: Berisi file-file untuk laporan (`barang-terlaris/index.php`, `barang-terlaris/print.php`, `stok-barang/index.php`, `stok-barang/print.php`, `user-aktif-tidak-aktif/index.php`, dan `user-aktif-tidak-aktif/print.php`).
- `users`: Berisi file-file untuk pengelolaan tabel `users` (`index.php`: daftar, `add.php`: tambah, dan `details.php`: edit/ubah password).
- `activity-logs.php`
- `index.php`
- `login.php`
- `logout.php`

## Panduan Pengembangan

Pada saat membuat file baru yang berekstensi `.php` pastikan untuk selalu memasukkan file `config/app.php` pada bagian atas kode atau file.

## Pengembang

- Ali
- Shafy
12 changes: 12 additions & 0 deletions assets/css/adminlte.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/css/adminlte.min.css.map

Large diffs are not rendered by default.

Binary file added assets/img/AdminLTELogo.png
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 assets/img/user2-160x160.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions assets/js/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"env": {
"jquery": true
},
"extends": [
"plugin:unicorn/recommended",
"xo",
"xo/browser"
],
"rules": {
"capitalized-comments": "off",
"comma-dangle": [
"error",
"never"
],
"indent": [
"error",
2,
{
"MemberExpression": "off",
"SwitchCase": 1
}
],
"multiline-ternary": [
"error",
"always-multiline"
],
"no-var": "off",
"object-curly-spacing": [
"error",
"always"
],
"object-shorthand": "off",
"prefer-arrow-callback": "off",
"semi": [
"error",
"never"
],
"strict": "error",
"unicorn/no-array-for-each": "off",
"unicorn/no-for-loop": "off",
"unicorn/no-null": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-dataset": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-node-append": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-spread": "off",
"unicorn/prevent-abbreviations": "off"
}
}
7 changes: 7 additions & 0 deletions assets/js/adminlte.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/js/adminlte.min.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions assets/plugins/bootstrap/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/plugins/bootstrap/js/bootstrap.bundle.min.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions assets/plugins/fontawesome-free/css/all.min.css

Large diffs are not rendered by default.

Binary file not shown.
3,717 changes: 3,717 additions & 0 deletions assets/plugins/fontawesome-free/webfonts/fa-brands-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
801 changes: 801 additions & 0 deletions assets/plugins/fontawesome-free/webfonts/fa-regular-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5,034 changes: 5,034 additions & 0 deletions assets/plugins/fontawesome-free/webfonts/fa-solid-900.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions assets/plugins/jquery/jquery.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/plugins/jquery/jquery.min.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

$app_url = 'http://localhost:8000';
5 changes: 5 additions & 0 deletions config/db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

require_once __DIR__ . '/app.php';

$conn = mysqli_connect("hostname", "username", "password", "inventarisku");
5 changes: 5 additions & 0 deletions config/session.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

require_once __DIR__ . '/app.php';

session_start();
162 changes: 162 additions & 0 deletions data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
INSERT INTO `users` (`name`, `email`, `password`, `level`) VALUES
('Admin', 'admin@example.com', 'password', '1'),
('User 1', 'user1@example.com', 'password1', '0'),
('User 2', 'user2@example.com', 'password2', '0'),
('User 3', 'user3@example.com', 'password3', '0'),
('User 4', 'user4@example.com', 'password4', '0'),
('User 5', 'user5@example.com', 'password5', '0'),
('User 6', 'user6@example.com', 'password6', '0'),
('User 7', 'user7@example.com', 'password7', '0'),
('User 8', 'user8@example.com', 'password8', '0'),
('User 9', 'user9@example.com', 'password9', '0'),
('User 10', 'user10@example.com', 'password10', '0'),
('User 11', 'user11@example.com', 'password11', '0'),
('User 12', 'user12@example.com', 'password12', '0'),
('User 13', 'user13@example.com', 'password13', '0'),
('User 14', 'user14@example.com', 'password14', '0'),
('User 15', 'user15@example.com', 'password15', '0'),
('User 16', 'user16@example.com', 'password16', '0'),
('User 17', 'user17@example.com', 'password17', '0'),
('User 18', 'user18@example.com', 'password18', '0'),
('User 19', 'user19@example.com', 'password19', '0'),
('User 20', 'user20@example.com', 'password20', '0'),
('User 21', 'user21@example.com', 'password21', '0'),
('User 22', 'user22@example.com', 'password22', '0'),
('User 23', 'user23@example.com', 'password23', '0'),
('User 24', 'user24@example.com', 'password24', '0'),
('User 25', 'user25@example.com', 'password25', '0');

INSERT INTO `items` (`name`, `price`, `stock`) VALUES
('Item 1', 100, 10),
('Item 2', 200, 20),
('Item 3', 300, 30),
('Item 4', 400, 40),
('Item 5', 500, 50),
('Item 6', 600, 60),
('Item 7', 700, 70),
('Item 8', 800, 80),
('Item 9', 900, 90),
('Item 10', 1000, 100),
('Item 11', 1100, 110),
('Item 12', 1200, 120),
('Item 13', 1300, 130),
('Item 14', 1400, 140),
('Item 15', 1500, 150),
('Item 16', 1600, 160),
('Item 17', 1700, 170),
('Item 18', 1800, 180),
('Item 19', 1900, 190),
('Item 20', 2000, 200),
('Item 21', 2100, 210),
('Item 22', 2200, 220),
('Item 23', 2300, 230),
('Item 24', 2400, 240),
('Item 25', 2500, 250);

INSERT INTO `in_h` (`date`, `total`) VALUES
('2024-01-01 00:00:00', 1000),
('2024-01-02 00:00:00', 2000),
('2024-01-03 00:00:00', 3000),
('2024-01-04 00:00:00', 4000),
('2024-01-05 00:00:00', 5000),
('2024-01-06 00:00:00', 6000),
('2024-01-07 00:00:00', 7000),
('2024-01-08 00:00:00', 8000),
('2024-01-09 00:00:00', 9000),
('2024-01-10 00:00:00', 10000),
('2024-01-11 00:00:00', 11000),
('2024-01-12 00:00:00', 12000),
('2024-01-13 00:00:00', 13000),
('2024-01-14 00:00:00', 14000),
('2024-01-15 00:00:00', 15000),
('2024-01-16 00:00:00', 16000),
('2024-01-17 00:00:00', 17000),
('2024-01-18 00:00:00', 18000),
('2024-01-19 00:00:00', 19000),
('2024-01-20 00:00:00', 20000),
('2024-01-21 00:00:00', 21000),
('2024-01-22 00:00:00', 22000),
('2024-01-23 00:00:00', 23000),
('2024-01-24 00:00:00', 24000),
('2024-01-25 00:00:00', 25000);

INSERT INTO `in_d` (`qty`, `subtotal`, `in_h_id`, `item_id`) VALUES
(1, 100, 1, 1),
(2, 200, 2, 2),
(3, 300, 3, 3),
(4, 400, 4, 4),
(5, 500, 5, 5),
(6, 600, 6, 6),
(7, 700, 7, 7),
(8, 800, 8, 8),
(9, 900, 9, 9),
(10, 1000, 10, 10),
(11, 1100, 11, 11),
(12, 1200, 12, 12),
(13, 1300, 13, 13),
(14, 1400, 14, 14),
(15, 1500, 15, 15),
(16, 1600, 16, 16),
(17, 1700, 17, 17),
(18, 1800, 18, 18),
(19, 1900, 19, 19),
(20, 2000, 20, 20),
(21, 2100, 21, 21),
(22, 2200, 22, 22),
(23, 2300, 23, 23),
(24, 2400, 24, 24),
(25, 2500, 25, 25);

INSERT INTO `out_h` (`date`, `total`) VALUES
('2024-01-01 00:00:00', 1000),
('2024-01-02 00:00:00', 2000),
('2024-01-03 00:00:00', 3000),
('2024-01-04 00:00:00', 4000),
('2024-01-05 00:00:00', 5000),
('2024-01-06 00:00:00', 6000),
('2024-01-07 00:00:00', 7000),
('2024-01-08 00:00:00', 8000),
('2024-01-09 00:00:00', 9000),
('2024-01-10 00:00:00', 10000),
('2024-01-11 00:00:00', 11000),
('2024-01-12 00:00:00', 12000),
('2024-01-13 00:00:00', 13000),
('2024-01-14 00:00:00', 14000),
('2024-01-15 00:00:00', 15000),
('2024-01-16 00:00:00', 16000),
('2024-01-17 00:00:00', 17000),
('2024-01-18 00:00:00', 18000),
('2024-01-19 00:00:00', 19000),
('2024-01-20 00:00:00', 20000),
('2024-01-21 00:00:00', 21000),
('2024-01-22 00:00:00', 22000),
('2024-01-23 00:00:00', 23000),
('2024-01-24 00:00:00', 24000),
('2024-01-25 00:00:00', 25000);

INSERT INTO `out_d` (`qty`, `subtotal`, `out_h_id`, `item_id`) VALUES
(1, 100, 1, 1),
(2, 200, 2, 2),
(3, 300, 3, 3),
(4, 400, 4, 4),
(5, 500, 5, 5),
(6, 600, 6, 6),
(7, 700, 7, 7),
(8, 800, 8, 8),
(9, 900, 9, 9),
(10, 1000, 10, 10),
(11, 1100, 11, 11),
(12, 1200, 12, 12),
(13, 1300, 13, 13),
(14, 1400, 14, 14),
(15, 1500, 15, 15),
(16, 1600, 16, 16),
(17, 1700, 17, 17),
(18, 1800, 18, 18),
(19, 1900, 19, 19),
(20, 2000, 20, 20),
(21, 2100, 21, 21),
(22, 2200, 22, 22),
(23, 2300, 23, 23),
(24, 2400, 24, 24),
(25, 2500, 25, 25);
14 changes: 14 additions & 0 deletions guards/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

require_once __DIR__ . '/../config/app.php';
require_once __DIR__ . '/../config/session.php';

if (!isset($_SESSION['user'])) {
header("Location: $app_url/login.php");
exit;
}

if ($_SESSION['user']['level'] != '1') {
header("Location: $app_url/index.php");
exit;
}
9 changes: 9 additions & 0 deletions guards/authenticated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

require_once __DIR__ . '/../config/app.php';
require_once __DIR__ . '/../config/session.php';

if (!isset($_SESSION['user'])) {
header("Location: $app_url/login.php");
exit;
}
9 changes: 9 additions & 0 deletions guards/guest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

require_once __DIR__ . '/../config/app.php';
require_once __DIR__ . '/../config/session.php';

if (isset($_SESSION['user'])) {
header("Location: $app_url/index.php");
exit;
}
14 changes: 14 additions & 0 deletions helpers/date.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

require_once __DIR__ . '/../config/app.php';

function day_diff($date1, $date2)
{
$time1 = strtotime($date1);
$time2 = strtotime($date2);

$second_diff = $time1 - $time2;
$day_diff = $second_diff / (60 * 60 * 24);

return floor($day_diff);
}
9 changes: 9 additions & 0 deletions helpers/guard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

require_once __DIR__ . '/../config/app.php';
require_once __DIR__ . '/../config/session.php';

function is_admin()
{
return $_SESSION['user']['level'] == '1';
}
Loading

0 comments on commit 2afe088

Please sign in to comment.