Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
99395d1
-udah bisa add edit delete
May 8, 2019
dbefea4
-di orders udah bisa nampilin details daftar barang yg dipesan
May 13, 2019
505bf85
-update repo ke punya tip
May 16, 2019
3603b42
Admin controller (#6)
azurast May 16, 2019
6e7f518
adding login and register controller and validation (#7)
cindmichelle May 16, 2019
7a8938a
small fixes
May 9, 2019
cfab05b
update buat controller home
May 9, 2019
3f20e2d
- created controllers/shop , this is for the pages that does not requ…
May 13, 2019
acc10ea
Views
May 13, 2019
07fdb13
Delete double folder & Manage admin views
May 15, 2019
10d6c94
Product Details
May 15, 2019
8eae020
Admin Controllers fixed
May 15, 2019
927df7f
Admin Edits
May 16, 2019
fa75e13
ganti warna sign up & sign in + di bold text nav nya
May 16, 2019
65bc3f1
- udh benerin fungsionalitas admin dgn controller baru
May 17, 2019
81b9830
display foto produk di list
May 17, 2019
6d20734
display foto di edit modal
May 17, 2019
2fd1bdc
hide image yg di add modal
May 17, 2019
2bf062c
Bisa filter category
samlrnt May 17, 2019
d3097e5
latest
samlrnt May 17, 2019
6811e1c
nambah session yg ilang di construct
samlrnt May 17, 2019
2bdc58e
minor changes
May 17, 2019
3db0e26
footer & harga
May 17, 2019
cb8cd1e
Shop
May 18, 2019
1dfecc4
About Us Page
May 18, 2019
2cbef81
Admin Profile
May 19, 2019
b26c313
Profile Customer
May 19, 2019
fd125be
View update (#14)
azurast May 20, 2019
b6e2fb1
-udah bisa add edit delete
May 8, 2019
0218f82
-di orders udah bisa nampilin details daftar barang yg dipesan
May 13, 2019
31c863d
-update repo ke punya tip
May 16, 2019
d06b34f
-udah bisa upload foto
May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion application/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
</IfModule>
4 changes: 2 additions & 2 deletions application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database', 'email', 'session');
$autoload['libraries'] = array('database', 'email', 'session', 'form_validation');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -89,7 +89,7 @@
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','file');
$autoload['helper'] = array('url','file','form');

/*
| -------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
$config['encryption_key'] = 'thu23456789';

/*
|--------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion application/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
// 'db_debug' => (ENVIRONMENT !== 'production'),
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
Expand Down
2 changes: 1 addition & 1 deletion application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'home';
$route['default_controller'] = 'collections';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
20 changes: 20 additions & 0 deletions application/controllers/Home.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends CI_Controller{

public function __construct(){
parent::__construct();
$this->load->model('product_model');
}

public function index(){
$data['result'] = $this->product_model->get_product();
$this->load->view('includes/css.php');
$this->load->view('includes/header_view.php');
$this->load->view('includes/content.php', $data);
$this->load->view('includes/footer_view.php');
$this->load->view('includes/js.php');
}
}
?>
202 changes: 162 additions & 40 deletions application/controllers/admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,84 +33,206 @@ class Admin extends CI_Controller {

public function __construct(){
parent::__construct();
$this->load->model('Admin_model');
$this->load->library('form_validation');
}

public function index(){
$this->load->model('Admin_model');
$data["title"] = "Dashboard";
$this->load->view('admin/headerAdmin_view',$data);
$this->load->view('admin/adminDashboard_view');
$this->load->view('admin/footerAdmin_view');
$t['title'] = "Dashboard";
$data['css'] = $this->load->view('includes/css.php', NULL, TRUE);
$data['js'] = $this->load->view('includes/js.php', NULL, TRUE);
$data['sidenav'] = $this->load->view('includes/admin/sidenav',NULL,TRUE);
$data['title'] = $this->load->view('includes/title',$t,TRUE);
$data['header'] = $this->load->view('includes/admin/header',NULL,TRUE);
$data['dashboard'] = $this->load->view('includes/admin/dashboard', NULL, TRUE);
$data['footer'] = $this->load->view('includes/admin/footer', NULL, TRUE);
$this->load->view('pages/admin/dashboard_view', $data);
}

public function profile(){
$this->load->model('Admin_model');
$data['title'] = "Admin Profile";
$this->load->view('admin/headerAdmin_view', $data);
$this->load->view('admin/adminProfile_view');
$this->load->view('admin/footerAdmin_view');
}

public function orders(){
$this->load->model('Order_model');
$data['title'] = "Order";
$data['orders'] = $this->Order_model->get_all_order();
$data['title'] = "Orders";
$data['orders'] = $this->Admin_model->get_order();
$data['orderDetails'] = $this->Admin_model->orderDetails();
$this->load->view('admin/headerAdmin_view', $data);
$this->load->view('admin/orderList_view', $data);
$this->load->view('admin/footerAdmin_view');
}
}
public function items(){
$this->load->model('Product_model');
$data['title'] = "Products";
$data['items'] = $this->Product_model->get_all_product();
$data['title'] = "Items";
$data['items'] = $this->Admin_model->get_item();
$this->load->view('admin/headerAdmin_view', $data);
$this->load->view('admin/itemList_view', $data);
$this->load->view('admin/footerAdmin_view');
}

public function customers(){
$this->load->model('Customer_model');


public function customers(){
$data['title'] = "Customers";
$data['customer'] = $this->Customer_model->get_all_customer();
$data['customer'] = $this->Admin_model->get_customers();
$this->load->view('admin/headerAdmin_view', $data);
$this->load->view('admin/customerList_view', $data);
$this->load->view('admin/footerAdmin_view');
}

public function edit(){

$param = [
"table" => $_POST['q'],
"where" => $_POST['where'],
"id" => $_POST['id']
];

$data['result'] = $this->Admin_model->clicked($param);
echo json_encode($data['result']);
}

public function edit($item){
//$data['edit'] = $this->Admin_model->clicked_item($item);
$this->load->view('admin/headerAdmin_view');
//$this->load->view('admin/editProduct_view', $data);
$this->load->view('admin/footerAdmin_view');
public function edit_action(){
if($_POST['title'] == 'products'){
$this->form_validation->set_rules('name','name','required|trim');
$this->form_validation->set_rules('price','price','required|trim|numeric');
$this->form_validation->set_rules('stock','stock','required|trim|numeric');
$this->form_validation->set_rules('category','category','required|in_list[tops,bottoms,dresses,accessories,jumpsuit]');

if($this->form_validation->run() == false){
$error = [
"status" => "error",
"message" => validation_errors()
];
echo json_encode($error);
die();
}
if($_FILES != NULL){
$config['upload_path'] = './images';
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$this->load->library('upload',$config);

if($this->upload->do_upload('image')){
$values = [
"productID" => $_POST['id'],
"productName" => $_POST['name'],
"productPrice" => $_POST['price'],
"productCategory" => $_POST['category'],
"productStock" => $_POST['stock'],
"productDescription" => $_POST['desc'],
"productImage" => base_url('images/'.$_FILES['image']['name'])
];
}
}
else{
$values = [
"productID" => $_POST['id'],
"productName" => $_POST['name'],
"productPrice" => $_POST['price'],
"productCategory" => $_POST['category'],
"productStock" => $_POST['stock'],
"productDescription" => $_POST['desc'],
"productImage" => $_POST['image']
];
}
}
else if($_POST['title'] == "customers"){
$values = [
"customerID" => $_POST['customerID'],
"fullName" => $_POST['fullName'],
"email" => $_POST['email'],
"address" => $_POST['address'],
"phone" => $_POST['phone'],
"username" => $_POST['username'],
"password" => $_POST['password']
];
}
else if($_POST['title'] == "orders"){
$values = [
"orderStatus" => $_POST['status'],
"orderID" => $_POST['orderID']
];
}

if($this->Admin_model->update($values, $_POST['title']) == 1){
$status = [
"status" => "success",
"message" => "success update data"
];
echo json_encode($status);
}else{
$status = [
"status" => "failed",
"message" => "failed update data"
];
echo json_encode($status);
}
}

public function add(){
$this->load->view('admin/headerAdmin_view');
//$this->load->view('admin/addProduct_view');
$this->load->view('admin/footerAdmin_view');
public function delete(){
echo $_POST['id'];
}

public function edit_action(){
$values = [
"ProductID" => $this->input->post('product_id'),
"ProductName" => $this->input->post('product_name'),
"UnitsInStock" => $this->input->post('stock'),
"UnitPrice" => $this->input->post('price')
public function delete_action(){
$param = [
"table" => $_POST['q'],
"where" => $_POST['where'],
"id" => $_POST['id']
];

$this->Admin_model->update($values);
redirect("admin/items");
$query = $this->Admin_model->delete($param);

return $query;
}

public function add_action(){
$values = [
"ProductID" => '',
"ProductName" => $this->input->post('product_name'),
"UnitsInStock" => $this->input->post('stock'),
"UnitPrice" => $this->input->post('price')
];
$this->form_validation->set_rules('name','name','required|trim');
$this->form_validation->set_rules('price','price','required|trim|numeric');
$this->form_validation->set_rules('stock','stock','required|trim|numeric');
$this->form_validation->set_rules('category','category','required|in_list[tops,bottoms,dresses,accessories,jumpsuit]');

if($this->form_validation->run() == false){
$error = [
"status" => "error",
"message" => validation_errors()
];
echo json_encode($error);
}
else{
$config['upload_path'] = './images';
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$this->load->library('upload',$config);

$this->Admin_model->insert($values);
redirect("admin/items");
if($this->upload->do_upload('image')){
$values = [
"productID" => $_POST['id'],
"productName" => $_POST['name'],
"productDescription" => $_POST['desc'],
"productPrice" => $_POST['price'],
"productStock" => $_POST['stock'],
"productCategory" => $_POST['category'],
"productImage" => base_url('images/'.$_FILES['image']['name'])
];

if($this->Admin_model->insert($values) == 0){
$status = [
"status" => "success",
"message" => "success insert data"
];
echo json_encode($status);
}
else{
$status = [
"status" => "failed",
"message" => "failed insert data"
];
echo json_encode($status);
}
}

}
}
}
42 changes: 35 additions & 7 deletions application/controllers/admin/Customers.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH.'controllers/user/Login.php';

class Customers extends CI_Controller {
class Customers extends Login {

public function __construct(){
parent::__construct();
}

public function index(){
$this->load->model('Customer_model');
$data['title'] = "Customers";
$data['customer'] = $this->Customer_model->get_all_customer();
$this->load->view('admin/headerAdmin_view', $data);
$this->load->view('admin/customerList_view', $data);
$this->load->view('admin/footerAdmin_view');

$this->check_is_login('admin');

$dt['customer'] = $this->Customer_model->get_all_customer();
$dt['title'] = "Customers";
$data['css'] = $this->load->view('includes/css.php', NULL, TRUE);
$data['js'] = $this->load->view('includes/js.php', NULL, TRUE);
$data['sidenav'] = $this->load->view('includes/admin/sidenav',NULL,TRUE);
$data['title'] = $this->load->view('includes/title',$dt,TRUE);
$data['header'] = $this->load->view('includes/admin/header', NULL ,TRUE);
$data['customers'] = $this->load->view('includes/admin/customers', NULL, TRUE);
$data['footer'] = $this->load->view('includes/admin/footer', NULL, TRUE);
$this->load->view('pages/admin/customers_view', $data);
}

public function update_customer(){
Expand All @@ -40,4 +49,23 @@ public function delete_customer(){
redirect("admin/customers");
}

public function edit($item){
//$data['edit'] = $this->Admin_model->clicked_item($item);
$this->load->view('admin/headerAdmin_view');
//$this->load->view('admin/editProduct_view', $data);
$this->load->view('admin/footerAdmin_view');
}

public function edit_action(){
$values = [
"ProductID" => $this->input->post('product_id'),
"ProductName" => $this->input->post('product_name'),
"UnitsInStock" => $this->input->post('stock'),
"UnitPrice" => $this->input->post('price')
];

$this->Admin_model->update($values);
redirect("admin/items");
}

}
Loading