<repo_name>Aditya170894/test-dumbways-21-kloter-2<file_sep>/dwbike/detail.php
<?php 
require 'functions.php';
$datas = query("SELECT * FROM `cycle` WHERE id = {$_GET["id"]}");
$data = $datas[0];
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="<KEY>" crossorigin="anonymous">
  <title>DW Bike</title>
  <style>
    *{
      padding: 0;
      margin: 0;
    }
    a {
      text-decoration: none;
    }
    .container {
      height: 100%;
    }
    p {
      color: #ffffff;
    }
    .d-flex {
      color: #ffffff;
    }
    .image-author img {
      height: 200px;
      width: 120px;
      object-fit: cover;
    }
    .card-list {
      padding: 20px;
    }
    .image-author {
      width: 120px;
    }
    .card-title {
      font-size: 30px;
      font-weight: bold;
    }
    .card {
      height: 700px;
    }
    .body-img {
      width: 50%;
      height: 350px;
      object-fit: cover;
    }
    .card-text {
      height: 100px;
    }
    .btn-body {
      background-color: #292938;
      color: blue;
    }
  </style>
</head>
<body style="background-color:#000000">
    <div class="container">
      <div class="d-flex flex-row my-5 justify-content-between">
        <div>
          <div class="card-body">
            <h5 class="card-title" style="color: #ffffff;"><?=$data["name"]?></h5>
            <img class="body-img my-5" src=<?=$data["image"]?> alt="...">
            
          </div>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
</body>
</html><file_sep>/dwbike/index.php
<?php
require 'functions.php';
$datas = query("SELECT * FROM `cycle`");


if (isset($_POST["submit-post"])) {
  insertPost($_POST);
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="<KEY>" crossorigin="anonymous">
  <title>DW Bike</title>
  <style>
    *{
      padding: 0;
      margin: 0;
    }
    a {
      text-decoration: none;
    }
    .container {
      height: 100%;
    }
    p {
      color: #ffffff;
    }
    .d-flex {
      color: #ffffff;
    }
    .image-author img {
      height: 120px;
      width: 120px;
      object-fit: cover;
    }
    .card-list {
      padding: 20px;
    }
    .image-author {
      width: 120px;
    }
    .card {
      height: 300px;
      width: 180px;
    }
    .body-img {
      width: 900px;
      height: 350px;
      object-fit: cover;
    }
    .card-text {
      height: 100px;
    }
    .btn-body {
      background-color: grey;
      color: blue;
    }
  </style>
</head>
<body style="background-color:#000000">
    <div class="container">
      <div class="d-flex flex-row my-5 justify-content-between">
        <h3>DW Bike</h3>
        <button type="button" data-bs-toggle="modal" data-bs-target="#modalPost" class="btn btn-warning btn-post">My Order</button>
      </div>
      <?php $i = 1; ?>
      <?php foreach ($datas as $data) : ?>
      <div class="card mb-3 mt-3 p-2 d-flex" style="background-color: #292929;">
        <div class="d-flex flex-row card-list">
          <div class="col-md-4 image-author text-center">
            <img src=<?= $data['image']; ?> alt="...">
            <div><?=$data["name"]?></div>
            <div>stock: <?=$data["stock"]?></div>
            <div class="text-center">
                <a href=<?="./detail.php?id={$data["id"]}";?> >
                  <button class="btn btn-body" type="button">Buy</button>
                </a>
              </div>
          </div>
          <div>
          </div>
        </div>
      </div>
    <?php $i++; ?>
    <?php endforeach; ?>

    <!-- Modal Post -->
  <div class="modal fade" id="modalPost" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <form class="modal-content" method="post">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">My Order</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <div class="input-group mb-3">
            <div class="input-group-prepend">
              <span class="input-group-text" id="basic-addon1">Nama Sepeda</span>
            </div>
            <input type="text" class="form-control" placeholder="<NAME>" aria-label="Username" aria-describedby="basic-addon1" name="name" id="name">
          </div>
        </div>
        <div class="modal-body">
          <div class="input-group mb-3">
            <div class="input-group-prepend">
              <span class="input-group-text" id="basic-addon1">Address</span>
            </div>
            <input type="text" class="form-control" placeholder="Address" aria-label="Username" aria-describedby="basic-addon1" name="address" id="address">
          </div>
        </div>
        <div class="modal-body">
          <div class="input-group mb-3">
            <div class="input-group-prepend">
              <span class="input-group-text" id="basic-addon1">image</span>
            </div>
            <input type="text" class="form-control" placeholder="image" aria-label="Username" aria-describedby="basic-addon1" name="image" id="image">
          </div>
        </div>
        <div class="modal-body">
          <div class="input-group mb-3">
            <div class="input-group-prepend">
              <span class="input-group-text" id="basic-addon1">Akreditasi</span>
            </div>
            <select name="school_level" id="school_level">
            <option value="A">A</option>
            <option value="B">B</option>
            <option value="C">C</option>
            </select>
          </div>
        </div>
        <div class="modal-body">
          <div class="input-group mb-3">
            <div class="input-group-prepend">
              <span class="input-group-text" id="basic-addon1">Status Sekolah</span>
            </div>
            <select name="status_school" id="status_school">
            <option value="Negeri">Negeri</option>
            <option value="Swasta">Swasta</option>
            </select>            
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="submit" class="btn btn-primary" name="submit-post">Save changes</button>
        </div>
      </form>
    </div>
  </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
  </body>
</html><file_sep>/2.js
const array1 = ['apa', 'saya', 'anda', 'kamu', 'hallo'];
const array2 = [
    'apa yang anda lakukan?',
    'selamat pagi',
    'kamu ternyata cantik juga ya',
    'yukk belajar javascript',
    'kamu itu adalah kebanggaan saya',
    'music hari ini yang akan di putar oleh gabut FM apa ya?'];

function filterKoneversiArr(array1, array2, vocal) {
    let countArray1 = {};
    const newArray = array2.map((item) => {
        return item.split(' ').map((str) => {
            let newStr = str;
            array1.forEach(element => {
                if (countArray1[element] === undefined) {
                    countArray1[element] = 0;
                }
                if (element === str) {
                    newStr = str.replace(/a|i|u|o|e/g, vocal);
                        countArray1[element] += 1
                }
            });
            return newStr
        }).join(' ')
    })

    array1.forEach(letter => {
        console.log('Kata ' + letter + ' muncul sebanyak: ' + countArray1[letter]);
    });
    console.log(newArray);
    console.log(countArray1);
    return newArray;
}
filterKoneversiArr(array1, array2, 'i');<file_sep>/dw_bike.sql
-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Feb 06, 2021 at 03:58 PM
-- Server version: 5.5.32
-- PHP Version: 5.4.16

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `dw_bike`
--
CREATE DATABASE IF NOT EXISTS `dw_bike` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `dw_bike`;

-- --------------------------------------------------------

--
-- Table structure for table `cycle`
--

CREATE TABLE IF NOT EXISTS `cycle` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `price` varchar(50) NOT NULL,
  `stock` int(11) NOT NULL,
  `image` varchar(300) NOT NULL,
  `id_merk` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

--
-- Dumping data for table `cycle`
--

INSERT INTO `cycle` (`id`, `name`, `price`, `stock`, `image`, `id_merk`) VALUES
(6, 'M6E 2020', '35000000', 5, 'https://s0.bukalapak.com/img/58283534962/large/data.jpeg.webp', 0),
(7, 'M6L 2021 BNIB', '44000000', 15, 'https://s3.bukalapak.com/img/32924155672/large/data.png.webp', 0);

-- --------------------------------------------------------

--
-- Table structure for table `merk`
--

CREATE TABLE IF NOT EXISTS `merk` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `merk`
--

INSERT INTO `merk` (`id`, `name`) VALUES
(3, 'BROMPTON'),
(4, 'HIMO');

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `email` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `name`, `email`, `password`) VALUES
(1, 'komar', '<EMAIL>', '<PASSWORD>'),
(2, 'udin', '<EMAIL>', '<PASSWORD>'),
(3, 'kurapika', '<EMAIL>', ''),
(4, 'gon', '<EMAIL>', '<PASSWORD>');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<file_sep>/4a.sql
SELECT * FROM `cycle`

SELECT `id`, `name`, `price`, `stock`, `image`, `id_merk` FROM `cycle` WHERE id_merk = "BROMPTON"

UPDATE `cycle` SET `name`="M6E 2020",`price`="35000000",`stock`="5",`image`="https://s0.bukalapak.com/img/58283534962/large/data.jpeg.webp" WHERE id_merk = "BROMPTON"

SELECT * FROM `cycle` WHERE stock = 15

SELECT * FROM `cycle` WHERE id_merk = "BROMPTON"