tambah fitur produk

master
Hafidz Fachrisyah Widyarix 2021-09-16 15:37:22 +07:00
parent 8734950537
commit 2a453c851c
23 changed files with 2395 additions and 30 deletions

18
.gitignore vendored
View File

@ -1,21 +1,5 @@
# ---> CodeIgniter
*/config/development
*/logs/log-*.php
!*/logs/index.html
*/cache/*
!*/cache/index.html
!*/cache/.htaccess
user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
#codeigniter 3
application/logs/*
!application/logs/index.html
!application/logs/.htaccess
/vendor/
db_umkm2.sql
application/config/database.php

View File

@ -77,8 +77,8 @@ $db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'your_mysql_username',
'password' => 'your_mysql_password',
'database' => 'your_db_name',
'password' => '',
'database' => 'your_database_name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,

View File

@ -17,14 +17,18 @@ class Login extends CI_Controller {
if($this->session->userdata('user_logged')->level=='admin'){
redirect(site_url('admin/dashboard'));
} else {
redirect(site_url('dashboard'));
redirect(site_url('user/dashboard'));
}
}
if($this->input->post()){
if($this->UserModel->doLogin()) {
redirect(site_url('admin/dashboard'));
if($this->UserModel->isPemilik()){
redirect(site_url('user/dashboard'));
} else {
redirect(site_url('admin/dashboard'));
}
} else {
$data['error']="Username atau Password salah !";
$this->load->view('login',$data);

View File

@ -0,0 +1,40 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Dashboard extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UmkmModel");
$this->load->model("UserModel");
$this->load->model("KategoriModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
}
public function index()
{
if($this->input->get()){
$get = $this->input->get();
if(isset($get['pemilik'])){
$data['del_pemilik']= $get['pemilik'];
}
$data['del_msg']= $get['del_msg'];
}
$data['user_logged'] = $this->session->userdata('user_logged');
$data['data_umkm'] = $this->UmkmModel->getUmkmsByIdPemilik($data['user_logged']->id_user);
$this->load->view('user/dashboard',$data);
}
}

View File

@ -0,0 +1,120 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class DetailUmkm extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("UmkmModel");
$this->load->model("KategoriModel");
$this->load->model("AbsensiModel");
$this->load->model("AbsenModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
$get = $this->input->get();
if($get['id_umkm']==NULL){
redirect(site_url('user/dashboard'));
}
}
public function index()
{
$get = $this->input->get();
$umkm = $this->UmkmModel->getUmkmsById($get['id_umkm']);
$pemilik = $this->UserModel->getUsersById($umkm->id_pemilik);
$daftarkategori = $this->KategoriModel->getKategori();
// var_dump($this->input->post());die();
if($this->input->post()){
$post = $this->input->post();
if($this->AbsensiModel->update($post['id_absensi'])){
redirect(site_url('user/detailumkm?id_umkm='.$umkm->id_umkm.'&msg=success'));
} else {
$data['msg']="error!";
}
}
$cekabsensiakhir = $this->AbsensiModel->getLatestSignedAbsensiCountByUmkmId($umkm->id_umkm);
if($cekabsensiakhir > 0 ){
$absensiakhir = $this->AbsensiModel->getLatestSignedAbsensiByUmkmId($umkm->id_umkm);
$aset = $absensiakhir->aset;
$karyawan_l = $absensiakhir->karyawan_l;
$karyawan_p = $absensiakhir->karyawan_p;
$data['listabsensi'] = $this->AbsensiModel->getSignedAbsensiByUmkmId($umkm->id_umkm);
} else {
$aset = $umkm->aset_awal;
$karyawan_l = $umkm->karyawan_l;
$karyawan_p = $umkm->karyawan_p;
$data['listabsensi'] = array();
}
$data['omset'] = $umkm->omset_awal;
$data['karyawan_l'] = $karyawan_l;
$data['karyawan_p'] = $karyawan_p;
$data['aset'] = $aset;
$data['daftarkategori'] = $daftarkategori;
$data['umkm'] = $umkm;
$data['pemilik'] = $pemilik;
$data['user_logged'] = $this->session->userdata('user_logged');
if($this->AbsenModel->getCountActiveAbsen()>0){
$data['data_absen'] = $this->AbsenModel->getActiveAbsen();
if($data['data_absen']->bulan=='1'){
$bulan = 'Januari';
} elseif($data['data_absen']->bulan=='2'){
$bulan = 'Februari';
} elseif($data['data_absen']->bulan=='3'){
$bulan = 'Maret';
} elseif($data['data_absen']->bulan=='4'){
$bulan = 'April';
} elseif($data['data_absen']->bulan=='5'){
$bulan = 'Mei';
} elseif($data['data_absen']->bulan=='6'){
$bulan = 'Juni';
} elseif($data['data_absen']->bulan=='7'){
$bulan = 'Juli';
} elseif($data['data_absen']->bulan=='8'){
$bulan = 'Agustus';
} elseif($data['data_absen']->bulan=='9'){
$bulan = 'September';
} elseif($data['data_absen']->bulan=='10'){
$bulan = 'Oktober';
} elseif($data['data_absen']->bulan=='11'){
$bulan = 'November';
} elseif($data['data_absen']->bulan=='12'){
$bulan = 'Desember';
}
$data['bulan'] = $bulan;
$data['active_absen'] = true;
$data['absenisiaktif'] = $this->AbsensiModel->getAbsensiByAbsenIdAndUmkmId($umkm->id_umkm,$data['data_absen']->id_absen);
} else {
$data['data_absen'] = '';
$data['active_absen'] = false;
}
$this->load->view('user/detailumkm',$data);
}
}

View File

@ -0,0 +1,84 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class EditUmkm extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("UmkmModel");
$this->load->model("KategoriModel");
$this->load->model("KelurahanModel");
$this->load->model("JenisModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
$get = $this->input->get();
if($get['id_umkm']==NULL){
redirect(site_url('user/dashboard'));
}
}
public function index()
{
$get = $this->input->get();
$umkm = $this->UmkmModel->getUmkmsById($get['id_umkm']);
if($this->input->post()){
if(strlen($_FILES['foto_umkm']['tmp_name'])>0){
$config['upload_path'] = './assets/images/umkm/';
$config['allowed_types'] = 'jpg|jpeg|gif|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$config['file_name'] = $umkm->id_umkm;
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('foto_umkm')){
$data['error_upload'] = $this->upload->display_errors();
} else {
$foto_lama = $umkm->foto_umkm;
$file = $this->upload->data();
if($this->UmkmModel->userUpdate($umkm->id_umkm,$file['file_name'])){
if($umkm->foto_umkm!=='umkm.png'){
unlink('./assets/images/umkm/'.$foto_lama);
}
redirect(site_url('user/editumkm?id_umkm='.$umkm->id_umkm.'&msg=success'));
} else {
$data['msg']="error!";
}
}
} else{
$foto_umkm = $umkm->foto_umkm;
if($this->UmkmModel->userUpdate($umkm->id_umkm,$foto_umkm)){
redirect(site_url('user/editumkm?id_umkm='.$umkm->id_umkm.'&msg=success'));
} else {
$data['msg']="error!";
}
}
}
$daftarjenis = $this->JenisModel->getJenis();
$data['daftarjenis'] = $daftarjenis;
$data['listkelurahan'] = $this->KelurahanModel->getKelurahan();
$data['umkm'] = $umkm;
$data['user_logged'] = $this->session->userdata('user_logged');
$this->load->view('user/editumkm',$data);
}
}

View File

@ -0,0 +1,50 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class HapusProduk extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("UmkmModel");
$this->load->model("AbsensiModel");
$this->load->model("ProdukModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
$get = $this->input->get();
if($get['id_produk']==NULL){
redirect(site_url('user/dashboard'));
}
}
public function index()
{
$get = $this->input->get();
$produk = $this->ProdukModel->getProdukById($get['id_produk']);
$id_umkm = $produk->id_umkm;
if($produk->foto_produk!=='default.png'){
unlink('./assets/images/produk/'.$produk->foto_produk);
}
$this->ProdukModel->delete($get['id_produk']);
redirect(site_url('user/produk?del_msg=success&id_umkm='.$id_umkm));
$data['produk'] = $produk;
$data['user_logged'] = $this->session->userdata('user_logged');
}
}

View File

@ -0,0 +1,87 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Produk extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("UmkmModel");
$this->load->model("KategoriModel");
$this->load->model("AbsensiModel");
$this->load->model("AbsenModel");
$this->load->model("ProdukModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
$get = $this->input->get();
if($get['id_umkm']==NULL){
redirect(site_url('user/dashboard'));
}
}
public function index()
{
$get = $this->input->get();
if($this->input->get()){
if(isset($get['del_msg'])){
$data['del_msg']= $get['del_msg'];
}
}
$umkm = $this->UmkmModel->getUmkmsById($get['id_umkm']);
$pemilik = $this->UserModel->getUsersById($umkm->id_pemilik);
$daftarkategori = $this->KategoriModel->getKategori();
$daftarproduk = $this->ProdukModel->getProdukByUmkmId($umkm->id_umkm);
// var_dump($this->input->post());die();
$cekabsensiakhir = $this->AbsensiModel->getLatestSignedAbsensiCountByUmkmId($umkm->id_umkm);
if($cekabsensiakhir > 0 ){
$absensiakhir = $this->AbsensiModel->getLatestSignedAbsensiByUmkmId($umkm->id_umkm);
$aset = $absensiakhir->aset;
$karyawan_l = $absensiakhir->karyawan_l;
$karyawan_p = $absensiakhir->karyawan_p;
$data['listabsensi'] = $this->AbsensiModel->getSignedAbsensiByUmkmId($umkm->id_umkm);
} else {
$aset = $umkm->aset_awal;
$karyawan_l = $umkm->karyawan_l;
$karyawan_p = $umkm->karyawan_p;
$data['listabsensi'] = array();
}
$data['omset'] = $umkm->omset_awal;
$data['karyawan_l'] = $karyawan_l;
$data['karyawan_p'] = $karyawan_p;
$data['aset'] = $aset;
$data['daftarkategori'] = $daftarkategori;
$data['daftarproduk'] = $daftarproduk;
$data['umkm'] = $umkm;
$data['pemilik'] = $pemilik;
$data['user_logged'] = $this->session->userdata('user_logged');
$this->load->view('user/produk',$data);
}
}

View File

@ -0,0 +1,74 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class RiwayatAbsensi extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("UmkmModel");
$this->load->model("KategoriModel");
$this->load->model("AbsensiModel");
$this->load->model("AbsenModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
$get = $this->input->get();
if($get['id_umkm']==NULL){
redirect(site_url('user/dashboard'));
}
}
public function index()
{
$get = $this->input->get();
$umkm = $this->UmkmModel->getUmkmsById($get['id_umkm']);
$pemilik = $this->UserModel->getUsersById($umkm->id_pemilik);
$daftarkategori = $this->KategoriModel->getKategori();
// var_dump($this->input->post());die();
$cekabsensiakhir = $this->AbsensiModel->getLatestSignedAbsensiCountByUmkmId($umkm->id_umkm);
if($cekabsensiakhir > 0 ){
$absensiakhir = $this->AbsensiModel->getLatestSignedAbsensiByUmkmId($umkm->id_umkm);
$aset = $absensiakhir->aset;
$karyawan_l = $absensiakhir->karyawan_l;
$karyawan_p = $absensiakhir->karyawan_p;
$data['listabsensi'] = $this->AbsensiModel->getSignedAbsensiByUmkmId($umkm->id_umkm);
} else {
$aset = $umkm->aset_awal;
$karyawan_l = $umkm->karyawan_l;
$karyawan_p = $umkm->karyawan_p;
$data['listabsensi'] = array();
}
$data['omset'] = $umkm->omset_awal;
$data['karyawan_l'] = $karyawan_l;
$data['karyawan_p'] = $karyawan_p;
$data['aset'] = $aset;
$data['daftarkategori'] = $daftarkategori;
$data['umkm'] = $umkm;
$data['pemilik'] = $pemilik;
$data['user_logged'] = $this->session->userdata('user_logged');
$this->load->view('user/riwayatabsensi',$data);
}
}

View File

@ -0,0 +1,126 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class TambahProduk extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("UmkmModel");
$this->load->model("KategoriModel");
$this->load->model("AbsensiModel");
$this->load->model("AbsenModel");
$this->load->model("ProdukModel");
if($this->UserModel->isNotLogin()) {
redirect(site_url('login'));
} elseif(!($this->UserModel->isPemilik())) {
redirect(site_url('admin/dashboard'));
}
$get = $this->input->get();
if($get['id_umkm']==NULL){
redirect(site_url('user/dashboard'));
}
}
public function index()
{
$get = $this->input->get();
$umkm = $this->UmkmModel->getUmkmsById($get['id_umkm']);
$pemilik = $this->UserModel->getUsersById($umkm->id_pemilik);
$daftarkategori = $this->KategoriModel->getKategori();
// var_dump($this->input->post());die();
if($this->input->post()){
$post=$this->input->post();
if($post['produk']!=='default'){
if($this->ProdukModel->save($umkm->id_umkm)){
$current_produk = $this->ProdukModel->getLastProdukByIdUmkm($umkm->id_umkm);
if(strlen($_FILES['foto_produk']['tmp_name'])>0){
$config['upload_path'] = './assets/images/produk/';
$config['allowed_types'] = 'jpg|jpeg|gif|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$config['file_name'] = $current_produk->id_produk;
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('foto_produk')){
$foto_produk = 'default.png';
$this->ProdukModel->setFirstImage($current_produk->id_produk,$foto_produk);
$data['error_upload'] = $this->upload->display_errors();
$data['msg']="success";
} else {
$file = $this->upload->data();
if($this->ProdukModel->setFirstImage($current_produk->id_produk,$file['file_name'])){
$data['msg']="success";
} else {
$foto_produk = 'default.png';
$this->ProdukModel->setFirstImage($current_produk->id_produk,$foto_produk);
$data['error_upload'] = 'gagal upload foto';
$data['msg']="success";
}
}
} else {
$foto_produk = 'default.png';
$this->ProdukModel->setFirstImage($current_produk->id_produk,$foto_produk);
$data['msg']="success";
}
} else {
$data['msg']="error!";
}
} else {
$data['msg']="error!";
}
}
$cekabsensiakhir = $this->AbsensiModel->getLatestSignedAbsensiCountByUmkmId($umkm->id_umkm);
if($cekabsensiakhir > 0 ){
$absensiakhir = $this->AbsensiModel->getLatestSignedAbsensiByUmkmId($umkm->id_umkm);
$aset = $absensiakhir->aset;
$karyawan_l = $absensiakhir->karyawan_l;
$karyawan_p = $absensiakhir->karyawan_p;
$data['listabsensi'] = $this->AbsensiModel->getSignedAbsensiByUmkmId($umkm->id_umkm);
} else {
$aset = $umkm->aset_awal;
$karyawan_l = $umkm->karyawan_l;
$karyawan_p = $umkm->karyawan_p;
$data['listabsensi'] = array();
}
$data['omset'] = $umkm->omset_awal;
$data['karyawan_l'] = $karyawan_l;
$data['karyawan_p'] = $karyawan_p;
$data['aset'] = $aset;
$data['daftarkategori'] = $daftarkategori;
$data['umkm'] = $umkm;
$data['pemilik'] = $pemilik;
$data['user_logged'] = $this->session->userdata('user_logged');
$this->load->view('user/tambahproduk',$data);
}
}

View File

@ -10,6 +10,22 @@ class AbsensiModel extends CI_Model
return $absensi = $this->db->get($this->_table)->result();
}
public function getAbsensiByAbsenIdAndUmkmId($id_umkm,$id_absen){
$this->db->where('id_absen', $id_absen);
$this->db->where('id_umkm', $id_umkm);
return $absensi = $this->db->get($this->_table)->row();
}
public function update($id_absensi){
$post = $this->input->post();
$this->aset = $post["aset"];
$this->omset = $post["omset"];
$this->karyawan_l = $post["karyawan_l"];
$this->karyawan_p = $post["karyawan_p"];
$this->signed = 1;
return $this->db->update($this->_table, $this, array('id_absensi' => $id_absensi));
}
public function getLastMonthAbsensi($bulan,$tahun){
$bulan = $bulan-1;
$this->db->where('bulan', $bulan);
@ -75,6 +91,7 @@ class AbsensiModel extends CI_Model
public function getSignedAbsensiByUmkmId($id_umkm){
$this->db->where('signed', true);
$this->db->where('id_umkm', $id_umkm);
$this->db->where('tahun', date('Y'));
$this->db->order_by('bulan', 'DESC');
$this->db->order_by('tahun', 'DESC');
return $user = $this->db->get($this->_table)->result();

View File

@ -0,0 +1,47 @@
<?php
class ProdukModel extends CI_Model
{
private $_table = "tb_produk";
public function save($id_umkm)
{
$post = $this->input->post();
$this->id_umkm = $id_umkm;
$this->produk = $post["produk"];
$this->deskripsi = $post["deskripsi"];
$this->foto_produk = "default.png";
return $this->db->insert($this->_table, $this);
}
public function getProdukByUmkmId($id_umkm){
$this->db->where('id_umkm', $id_umkm);
$this->db->order_by('produk', 'DESC');
return $produk = $this->db->get($this->_table)->result();
}
public function getProdukById($id_produk){
$this->db->where('id_produk', $id_produk);
return $produk = $this->db->get($this->_table)->row();
}
public function getLastProdukByIdUmkm($id_umkm){
$this->db->where('id_umkm', $id_umkm);
$this->db->order_by('id_produk', 'DESC');
return $umkm = $this->db->get($this->_table)->row();
}
public function setFirstImage($id_produk,$foto_produk)
{
$this->foto_produk = $foto_produk;
return $this->db->update($this->_table, $this, array('id_produk' => $id_produk));
}
public function delete($id_produk)
{
return $this->db->delete($this->_table, array("id_produk" => $id_produk));
}
}

View File

@ -66,6 +66,7 @@ class UmkmModel extends CI_Model
public function getUmkmsByIdPemilik($id_pemilik){
$this->db->join('tb_kategori','tb_kategori.id_kategori = tb_umkm.id_kategori');
$this->db->join('tb_jenis','tb_jenis.id_jenis = tb_umkm.id_jenis');
$this->db->where('id_pemilik', $id_pemilik);
return $umkm = $this->db->get($this->_table)->result();
}
@ -127,6 +128,20 @@ class UmkmModel extends CI_Model
return $this->db->update($this->_table, $this, array('id_umkm' => $id_umkm));
}
public function userUpdate($id_umkm,$foto_umkm)
{
$post = $this->input->post();
$this->nama = $post["nama"];
$this->id_jenis = $post["jenis"];
$this->telp = $post["telp"];
$this->deskripsi = $post["deskripsi"];
$this->foto_umkm = $foto_umkm;
return $this->db->update($this->_table, $this, array('id_umkm' => $id_umkm));
}
public function delete($id_umkm)
{
return $this->db->delete($this->_table, array("id_umkm" => $id_umkm));

View File

@ -0,0 +1,197 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
<style>
/* Hide scrollbar for Chrome, Safari and Opera */
.hdscr::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.hdscr {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="<?php echo base_url()?>assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="<?php echo base_url('index.php/')?>login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card" style="width: 18rem;">
<div class="card-header text-center">
<img src="<?php echo base_url()?>assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>user/dashboard" style="text-decoration:none;">
<li class="list-group-item border-bottom text-light active">Daftar UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>user/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col-md-9">
<div class="card">
<h5 class="card-header">Daftar UMKM</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/umkm" class="nav-link active">Daftar UMKM</a>
</li>
</ul>
<div class="mt-3 hdscr" style="max-height:400px;overflow-y: auto;">
<?php if (isset($del_msg)){
if($del_msg=='error'){
?>
<div class="alert alert-danger" role="alert">Tidak bisa menghapus <strong><?php echo $del_umkm ?></strong>
, kerena terdapat data absensi yang terkait !</div>
<?php }elseif($del_msg=='sucess'){ ?>
<div class="alert alert-success" role="alert">Data berhasil terhapus !</div>
<?php }} ?>
<table id="tabeldata" class="table table-striped table-bordered">
<thead>
<tr>
<th>No</th>
<th>Nama Umkm</th>
<th>Kecamatan</th>
<th>Kategori</th>
<th>Opsi</th>
</tr>
</thead>
<tbody>
<?php
$no=0;
foreach($data_umkm as $umkm) {
$no++;
?>
<tr>
<td><?php echo $no?></td>
<td><?php echo $umkm->nama?></td>
<td><?php echo $umkm->kecamatan?></td>
<?php
$kategori = $this->KategoriModel->getKategoriById($umkm->id_kategori);
?>
<td><?php echo $kategori->kategori?></td>
<td>
<a href="<?php echo base_url('index.php/')?>user/detailumkm?id_umkm=<?php echo $umkm->id_umkm ?>" class="btn btn-block btn-info btn-sm">Detail</a>
<a href="<?php echo base_url('index.php/')?>user/editumkm?id_umkm=<?php echo $umkm->id_umkm ?>" class="btn btn-block btn-warning btn-sm">Edit</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
<script>
const element = document.querySelectorAll('#btn_hapus')
element.forEach(function(el){
el.addEventListener('click', function (e) {
e.preventDefault();
var urlToRedirect = e.currentTarget.getAttribute('href'); //use currentTarget because the click may be on the nested i tag and not a tag causing the href to be empty
console.log(urlToRedirect); // verify if this is the right URL
swal({
title: "Kamu yakin ?",
text: "Data yang dihapus tidak bisa dikembalikan.",
icon: "warning",
buttons: [
'Batal',
'Hapus'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Berhasil',
text: 'Data berhasil terhapus',
icon: 'success'
}).then(function() {
window.location.href = urlToRedirect;
});
} else {
swal("Batal", "Data tidak terhapus.)", "error");
}
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,334 @@
<?php
function rupiah($angka){
$hasil_rupiah = "Rp " . number_format($angka,0,',','.');
return $hasil_rupiah;
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="../../assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card" style="width: 18rem;">
<div class="card-header text-center">
<img src="../../assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>user/dashboard" style="text-decoration:none;">
<li class="list-group-item border-bottom text-light active">Daftar UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>user/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col-md-9" >
<div class="card">
<h5 class="card-header">Data UMKM</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/dashboard" class="nav-link">Daftar UMKM</a>
</li>
<li class="nav-item">
<a href="" class="nav-link active">
Detail Umkm > <strong><?php echo $umkm->nama ?></strong></a>
</li>
</ul>
<div class="mt-3">
<div class="row pr-2">
<div class="col col-md-4 pt-4">
<div class="form-group text-center">
<img src="../../assets/images/umkm/<?php echo $umkm->foto_umkm ?>" width="135" class="img-thumbnail mb-2" /><br>
<strong><?php echo $umkm->nama?></strong>
</div>
</div>
<div class="col col-md-8">
<div class="row pt-1 ml-2 mb-0 pb-0">
<strong>DATA TERKINI</strong>
</div>
<hr>
<div class="row">
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-success">
TENAGA KERJA
</div>
<div class="card-body text-left">
<span class="badge badge-secondary">Laki-laki : <?php echo $karyawan_l?></span><br>
<span class="badge badge-secondary">Perempuan : <?php echo $karyawan_p?></span>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header bg-warning">
OMSET TAHUNAN
</div>
<div class="card-body">
<h6><?php echo rupiah($omset) ?></h6>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-info">
ASET TERAKHIR
</div>
<div class="card-body">
<h6><?php echo rupiah($aset) ?></h6>
</div>
</div>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
</div>
</div>
<div class="row pr-2">
<div class="col col-md-6">
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">No Telp</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->telp?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kategori</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kategori?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Jenis</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->jenis?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kelurahan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kelurahan?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kecamatan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kecamatan?></div>
</div>
</div>
<div class="col col-md-6">
<div class="row pb-2">
<div class="col col-md-12">Alamat</div>
<div class="col col-md-12">
<textarea class="form-control" rows="1" disabled><?php echo $umkm->alamat?></textarea>
</div>
</div>
<div class="row pb-2">
<div class="col col-md-12">Deskripsi</div>
<div class="col col-md-12">
<textarea class="form-control" rows="2" disabled><?php echo $umkm->deskripsi?></textarea>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/detailumkm?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link active">Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/riwayatabsensi?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Riwayat Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/produk?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Produk</a>
</li>
</ul>
<hr>
</div>
</div>
<div class="row mt-2">
<div class="col col-md-12">
<div class="card">
<div class="card-header bg-primary text-white">
Absen Aktif
</div>
<?php if($active_absen){?>
<div class="card-body">
<div class="row">
<div class="col col-auto">
<h5>Bulan <?php echo $bulan ?> Tahun <?php echo $data_absen->tahun ?></h5>
</div>
<div class="col text-right">
<?php if($absenisiaktif->signed==1){?>
<span class="badge badge-pill badge-success">Sudah Absen</span>
<?php }else{?>
<span class="badge badge-pill badge-warning text-dark">Belum Absen</span>
<?php } ?>
</div>
</div>
<hr>
<div class="row">
<form action="" method="POST" class="needs-validation">
<div class="row pl-3">
<?php
if(isset($msg)){
if($msg=='success'){
?>
<div class="col col-md-12">
<div class="alert alert-success" role="alert">Absensi berhasil tersimpan !</div>
</div>
<?php
} else {
?>
<div class="col col-md-12">
<div class="alert alert-danger" role="alert">Absensi gagal !</div>
</div>
<?php
}
}
?>
<div class="col col-md-6">
<input type="hidden" name='id_absensi' value="<?php echo $absenisiaktif->id_absensi ?>" readonly>
<div class="form-group">
<label for="aset">Aset Terkini</label>
<input type="number" name="aset" min="0" class="form-control" id="aset" placeholder="Aset terkini" value="<?php echo $absenisiaktif->aset ?>" required>
</div>
<div class="form-group">
<label for="omset">Omset Bulan Ini</label>
<input type="number" name="omset" min="0" class="form-control" id="omset" placeholder="Omset bulan ini" value="<?php echo $absenisiaktif->omset ?>" required>
</div>
</div>
<div class="col col-md-6">
<div class="form-group">
<label for="karyawan_l">Jumlah Tenaga Kerja (L)</label>
<input type="number" name="karyawan_l" class="form-control" min="0" id="karyawan_l" value="<?php echo $absenisiaktif->karyawan_l ?>" placeholder="Jumlah Karyawan laki-laki" required>
</div>
<div class="form-group">
<label for="karyawan_p">Jumlah Tenaga Kerja (P)</label>
<input type="number" name="karyawan_p" class="form-control" min="0" id="karyawan_p" value="<?php echo $absenisiaktif->karyawan_p ?>" placeholder="Jumlah Karyawan perempuan" required>
</div>
</div>
<div class="col col-md-12">
<hr>
<button type="submit" class="btn btn-primary">Update Absen</button>
</div>
</div>
</form>
</div>
</div>
<?php } else {?>
<div class="card-body text-center">
<img src="<?php echo base_url()?>assets/images/search.png" width="150" /><br>
<div class="alert alert-warning" role="alert">
Tidak ada <strong>absen aktif</strong> saat ini.
</div>
<div>
<a href="<?php echo base_url('index.php/')?>admin/tambahabsen" class="btn btn-lg btn-success">Buat Absensi</a>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<!-- next -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
</body>
</html>

View File

@ -0,0 +1,182 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="../../assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card" style="width: 18rem;">
<div class="card-header text-center">
<img src="../../assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>user/dashboard" style="text-decoration:none;">
<li class="list-group-item border-bottom text-light active">Daftar UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col-md-9" >
<div class="card">
<h5 class="card-header">Data UMKM</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/dashboard" class="nav-link">Daftar UMKM</a>
</li>
<li class="nav-item">
<a href="" class="nav-link active">
Edit Umkm > <strong><?php echo $umkm->nama ?></strong></a>
</li>
</ul>
<div class="mt-3">
<form action="" enctype="multipart/form-data" method="POST" class="needs-validation">
<div class="row">
<?php
if(isset($error_upload)){
?>
<div class="col col-md-12">
<div class="alert alert-danger" role="alert">Error : <?php echo $error_upload ?></div>
</div>
<?php
}
?>
<?php
if(isset($_GET['msg'])){
$msg = $_GET['msg'];
}
if(isset($msg)){
if($msg=='success'){
?>
<div class="col col-md-12">
<div class="alert alert-success" role="alert">Data berhasil tersimpan !</div>
</div>
<?php
} else {
?>
<div class="col col-md-12">
<div class="alert alert-danger" role="alert">Gagal, Data sudah ada !</div>
</div>
<?php
}
}
?>
<div class="col col-md-6">
<div class="form-group mb-2">
<img src="../../assets/images/umkm/<?php echo $umkm->foto_umkm ?>" width="135" class="img-thumbnail" />
</div>
<div class="form-group">
<label for="foto_umkm">Ganti Foto UMKM</label>
<input type="file" accept=".jpg,.jpeg,.png,.gif" name="foto_umkm" class="form-control-file" id="foto_umkm">
</div>
<div class="form-group">
<label for="nama">Nama Umkm</label>
<input type="text" name="nama" class="form-control" id="nama" placeholder="Nama Umkm" required value="<?php echo $umkm->nama?>">
</div>
</div>
<div class="col col-md-6">
<div class="form-group">
<label for="jenis">Jenis Usaha</label>
<select name="jenis" class="form-control" id="jenis" required>
<?php foreach($daftarjenis as $jenis){?>
<option value="<?php echo $jenis->id_jenis?>" <?php if($jenis->id_jenis==$umkm->id_jenis){ echo "selected";}?>><?php echo $jenis->jenis?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<label for="telp">No Telp Umkm</label>
<input type="text" name="telp" class="form-control" id="telp" value="<?php echo $umkm->telp?>" placeholder="No Telp Umkm" required>
</div>
<div class="form-group">
<label for="deskripsi">Deskripsi</label>
<textarea name="deskripsi" class="form-control" id="deskripsi" rows="3" placeholder="Uraikan deskripsi singkat UMKM..." required><?php echo $umkm->deskripsi?></textarea>
</div>
</div>
<div class="col col-md-12 text-right">
<hr>
<button type="submit" class="btn btn-primary btn-sm">Simpan</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
</body>
</html>

View File

@ -0,0 +1,319 @@
<?php
function rupiah($angka){
$hasil_rupiah = "Rp " . number_format($angka,0,',','.');
return $hasil_rupiah;
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="../../assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card" style="width: 18rem;">
<div class="card-header text-center">
<img src="../../assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>user/dashboard" style="text-decoration:none;">
<li class="list-group-item border-bottom text-light active">Daftar UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>user/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col-md-9" >
<div class="card">
<h5 class="card-header">Data UMKM</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/dashboard" class="nav-link">Daftar UMKM</a>
</li>
<li class="nav-item">
<a href="" class="nav-link active">
Detail Umkm > <strong><?php echo $umkm->nama ?></strong></a>
</li>
</ul>
<div class="mt-3">
<form action="" class="needs-validation">
<div class="row pr-2">
<div class="col col-md-4 pt-4">
<div class="form-group text-center">
<img src="../../assets/images/umkm/<?php echo $umkm->foto_umkm ?>" width="135" class="img-thumbnail mb-2" /><br>
<strong><?php echo $umkm->nama?></strong>
</div>
</div>
<div class="col col-md-8">
<div class="row pt-1 ml-2 mb-0 pb-0">
<strong>DATA TERKINI</strong>
</div>
<hr>
<div class="row">
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-success">
TENAGA KERJA
</div>
<div class="card-body text-left">
<span class="badge badge-secondary">Laki-laki : <?php echo $karyawan_l?></span><br>
<span class="badge badge-secondary">Perempuan : <?php echo $karyawan_p?></span>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header bg-warning">
OMSET TAHUNAN
</div>
<div class="card-body">
<h6><?php echo rupiah($omset) ?></h6>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-info">
ASET TERAKHIR
</div>
<div class="card-body">
<h6><?php echo rupiah($aset) ?></h6>
</div>
</div>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
</div>
</div>
<div class="row pr-2">
<div class="col col-md-6">
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">No Telp</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->telp?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kategori</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kategori?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Jenis</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->jenis?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kelurahan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kelurahan?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kecamatan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kecamatan?></div>
</div>
</div>
<div class="col col-md-6">
<div class="row pb-2">
<div class="col col-md-12">Alamat</div>
<div class="col col-md-12">
<textarea class="form-control" rows="1" disabled><?php echo $umkm->alamat?></textarea>
</div>
</div>
<div class="row pb-2">
<div class="col col-md-12">Deskripsi</div>
<div class="col col-md-12">
<textarea class="form-control" rows="2" disabled><?php echo $umkm->deskripsi?></textarea>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/detailumkm?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/riwayatabsensi?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Riwayat Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/produk?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link active">Produk</a>
</li>
</ul>
<hr>
</div>
</div>
<div class="row mt-2">
<?php
if (isset($del_msg)){
if($del_msg=='error'){
?>
<div class="alert alert-danger" role="alert">Tidak bisa menghapus <strong><?php echo $del_pemilik ?></strong>
, kerena terdapat data UMKM yang terkait !</div>
<?php } elseif($del_msg=='sucess'){ ?>
<div class="alert alert-success" role="alert">Data berhasil terhapus !</div>
<?php }}?>
<div class="col col-md-12">
<a href="<?php echo base_url('index.php/')?>user/tambahproduk?id_umkm=<?php echo $umkm->id_umkm ?>" class="btn btn-sm btn-success mb-3">Tambah Produk</a>
<table id="tabeldata" class="table table-striped table-bordered">
<thead>
<tr>
<th>Produk</th>
<th>Foto</th>
<th>Deskripsi</th>
</tr>
</thead>
<tbody>
<?php
foreach($daftarproduk as $produk) {
?>
<tr>
<td>
<img src="../../assets/images/produk/<?php echo $produk->foto_produk ?>" width="80" class="img-thumbnail" /><br>
</td>
<td><?php echo $produk->produk?></td>
<td><?php echo $produk->deskripsi?></td>
<td>
<a id="btn_hapus" href="<?php echo base_url('index.php/')?>user/hapusproduk?id_produk=<?php echo $produk->id_produk ?>&produk=<?php echo $produk->produk ?>" class="btn btn-block btn-danger btn-sm">Hapus</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!-- next -->
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
<script>
const element = document.querySelectorAll('#btn_hapus')
element.forEach(function(el){
el.addEventListener('click', function (e) {
e.preventDefault();
var urlToRedirect = e.currentTarget.getAttribute('href'); //use currentTarget because the click may be on the nested i tag and not a tag causing the href to be empty
console.log(urlToRedirect); // verify if this is the right URL
swal({
title: "Kamu yakin ?",
text: "Data yang dihapus tidak bisa dikembalikan.",
icon: "warning",
buttons: [
'Batal',
'Hapus'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Berhasil',
text: 'Data berhasil terhapus',
icon: 'success'
}).then(function() {
window.location.href = urlToRedirect;
});
} else {
swal("Batal", "Data tidak terhapus.)", "error");
}
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,303 @@
<?php
function rupiah($angka){
$hasil_rupiah = "Rp " . number_format($angka,0,',','.');
return $hasil_rupiah;
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="../../assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card" style="width: 18rem;">
<div class="card-header text-center">
<img src="../../assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>user/dashboard" style="text-decoration:none;">
<li class="list-group-item border-bottom text-light active">Daftar UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>user/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col-md-9" >
<div class="card">
<h5 class="card-header">Data UMKM</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/dashboard" class="nav-link">Daftar UMKM</a>
</li>
<li class="nav-item">
<a href="" class="nav-link active">
Detail Umkm > <strong><?php echo $umkm->nama ?></strong></a>
</li>
</ul>
<div class="mt-3">
<form action="" class="needs-validation">
<div class="row pr-2">
<div class="col col-md-4 pt-4">
<div class="form-group text-center">
<img src="../../assets/images/umkm/<?php echo $umkm->foto_umkm ?>" width="135" class="img-thumbnail mb-2" /><br>
<strong><?php echo $umkm->nama?></strong>
</div>
</div>
<div class="col col-md-8">
<div class="row pt-1 ml-2 mb-0 pb-0">
<strong>DATA TERKINI</strong>
</div>
<hr>
<div class="row">
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-success">
TENAGA KERJA
</div>
<div class="card-body text-left">
<span class="badge badge-secondary">Laki-laki : <?php echo $karyawan_l?></span><br>
<span class="badge badge-secondary">Perempuan : <?php echo $karyawan_p?></span>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header bg-warning">
OMSET TAHUNAN
</div>
<div class="card-body">
<h6><?php echo rupiah($omset) ?></h6>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-info">
ASET TERAKHIR
</div>
<div class="card-body">
<h6><?php echo rupiah($aset) ?></h6>
</div>
</div>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
</div>
</div>
<div class="row pr-2">
<div class="col col-md-6">
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">No Telp</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->telp?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kategori</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kategori?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Jenis</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->jenis?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kelurahan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kelurahan?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kecamatan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kecamatan?></div>
</div>
</div>
<div class="col col-md-6">
<div class="row pb-2">
<div class="col col-md-12">Alamat</div>
<div class="col col-md-12">
<textarea class="form-control" rows="1" disabled><?php echo $umkm->alamat?></textarea>
</div>
</div>
<div class="row pb-2">
<div class="col col-md-12">Deskripsi</div>
<div class="col col-md-12">
<textarea class="form-control" rows="2" disabled><?php echo $umkm->deskripsi?></textarea>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/detailumkm?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/riwayatabsensi?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link active">Riwayat Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/produk?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Produk</a>
</li>
</ul>
<hr>
</div>
</div>
<div class="row mt-2">
<div class="col col-md-12">
<table id="tabeldata" class="table table-striped table-bordered">
<thead>
<tr>
<th>Tahun</th>
<th>Bulan</th>
<th>Aset Terkini</th>
<th>Omset Bulan Ini</th>
<th>Jumlah l</th>
<th>Jumlah p</th>
</tr>
</thead>
<tbody>
<?php
foreach($listabsensi as $absensi) {
?>
<tr>
<td><?php echo $absensi->tahun?></td>
<?php
if($absensi->bulan==1){
$bulan = 'Januari';
} elseif($absensi->bulan==2){
$bulan = 'Februari';
} elseif($absensi->bulan==3){
$bulan = 'Maret';
} elseif($absensi->bulan==4){
$bulan = 'April';
} elseif($absensi->bulan==5){
$bulan = 'Mei';
} elseif($absensi->bulan==6){
$bulan = 'Juni';
} elseif($absensi->bulan==7){
$bulan = 'Juli';
} elseif($absensi->bulan==8){
$bulan = 'Agustus';
} elseif($absensi->bulan==9){
$bulan = 'September';
} elseif($absensi->bulan==10){
$bulan = 'Oktober';
} elseif($absensi->bulan==11){
$bulan = 'November';
} elseif($absensi->bulan==12){
$bulan = 'Desember';
} else {
$bulan = 'a/n';
}
?>
<td><?php echo $bulan ?></td>
<td><?php echo rupiah($absensi->aset) ?></td>
<td><?php echo rupiah($absensi->omset) ?></td>
<td><?php echo $absensi->karyawan_l ?></td>
<td><?php echo $absensi->karyawan_p ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!-- next -->
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
</body>
</html>

View File

@ -0,0 +1,354 @@
<?php
function rupiah($angka){
$hasil_rupiah = "Rp " . number_format($angka,0,',','.');
return $hasil_rupiah;
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css">
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="<?php echo base_url()?>assets/css/sweetalert.min.css" />
<link data-require="sweet-alert@*" data-semver="0.4.2" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" />
<link rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">
<img src="../../assets/images/logo-white.png" width="100" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<form methode="POST" action="../login/logout" class="form-inline my-2 my-lg-0" >
<button class="btn btn-outline-warning btn-sm my-2 my-sm-0" type="submit">Logout</button>
</form>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3" style="cursor:pointer;">
<div class="card" style="width: 18rem;">
<div class="card-header text-center">
<img src="../../assets/images/<?php echo $user_logged->foto_user ?>" width="125" /><br>
<strong><?php echo $user_logged->nama ?></strong>
</div>
<ul class="list-group list-group-flush">
<a href="<?php echo base_url('index.php/')?>user/dashboard" style="text-decoration:none;">
<li class="list-group-item border-bottom text-light active">Daftar UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>user/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col-md-9" >
<div class="card">
<h5 class="card-header">Data UMKM</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/dashboard" class="nav-link">Daftar UMKM</a>
</li>
<li class="nav-item">
<a href="" class="nav-link active">
Detail Umkm > <strong><?php echo $umkm->nama ?></strong></a>
</li>
</ul>
<div class="mt-3">
<div class="row pr-2">
<div class="col col-md-4 pt-4">
<div class="form-group text-center">
<img src="../../assets/images/umkm/<?php echo $umkm->foto_umkm ?>" width="135" class="img-thumbnail mb-2" /><br>
<strong><?php echo $umkm->nama?></strong>
</div>
</div>
<div class="col col-md-8">
<div class="row pt-1 ml-2 mb-0 pb-0">
<strong>DATA TERKINI</strong>
</div>
<hr>
<div class="row">
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-success">
TENAGA KERJA
</div>
<div class="card-body text-left">
<span class="badge badge-secondary">Laki-laki : <?php echo $karyawan_l?></span><br>
<span class="badge badge-secondary">Perempuan : <?php echo $karyawan_p?></span>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header bg-warning">
OMSET TAHUNAN
</div>
<div class="card-body">
<h6><?php echo rupiah($omset) ?></h6>
</div>
</div>
</div>
<div class="col col-md-4">
<div class="card text-center">
<div class="card-header text-light bg-info">
ASET TERAKHIR
</div>
<div class="card-body">
<h6><?php echo rupiah($aset) ?></h6>
</div>
</div>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
</div>
</div>
<div class="row pr-2">
<div class="col col-md-6">
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">No Telp</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->telp?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kategori</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kategori?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Jenis</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->jenis?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kelurahan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kelurahan?></div>
</div>
<div class="row pb-2 pl-3">
<div class="col col-md-4 pl-2 pr-2">Kecamatan</div>
<div class="col col-md-1 pl-2 pr-2">:</div>
<div class="col col-md-7 pl-2 pr-2"><?php echo $umkm->kecamatan?></div>
</div>
</div>
<div class="col col-md-6">
<div class="row pb-2">
<div class="col col-md-12">Alamat</div>
<div class="col col-md-12">
<textarea class="form-control" rows="1" disabled><?php echo $umkm->alamat?></textarea>
</div>
</div>
<div class="row pb-2">
<div class="col col-md-12">Deskripsi</div>
<div class="col col-md-12">
<textarea class="form-control" rows="2" disabled><?php echo $umkm->deskripsi?></textarea>
</div>
</div>
</div>
<div class="col col-md-12">
<hr>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/detailumkm?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/riwayatabsensi?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Riwayat Absen</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>user/produk?id_umkm=<?php echo $umkm->id_umkm ?>" class="nav-link">Produk</a>
</li>
<li class="nav-item">
<a href="" class="nav-link active">
> <strong>Tambah Produk</strong>
</a>
</li>
</ul>
<hr>
</div>
</div>
<div class="row mt-2">
<div class="col col-md-12">
<div class="card">
<div class="card-header bg-primary text-white">
Tambah Produk
</div>
<div class="card-body">
<div class="row">
<form action="" enctype="multipart/form-data" method="POST" class="needs-validation">
<div class="row pl-3">
<?php
if(isset($error_upload)){
?>
<div class="col col-md-12">
<div class="alert alert-danger" role="alert">Error : <?php echo $error_upload ?></div>
</div>
<?php
}
?>
<?php
if(isset($msg)){
if($msg=='success'){
?>
<div class="col col-md-12">
<div class="alert alert-success" role="alert">Produk berhasil tersimpan !</div>
</div>
<?php
} else {
?>
<div class="col col-md-12">
<div class="alert alert-danger" role="alert">Produk gagal disimpan !</div>
</div>
<?php
}
}
?>
<div class="col col-md-12">
<div class="form-group">
<label for="produk">Nama Produk</label>
<input type="text" name="produk" class="form-control" id="produk" placeholder="Nama Produk" required>
</div>
<div class="form-group mb-1">
<label for="deskripsi">Deskripsi</label>
<textarea name="deskripsi" class="form-control" id="deskripsi" rows="2" placeholder="Deskripsi produk.." required></textarea>
</div>
<div class="form-group">
<label for="foto_produk">Foto Produk</label>
<input type="file" accept=".jpg,.jpeg,.png,.gif" name="foto_produk" class="form-control-file" id="foto_produk">
</div>
</div>
<div class="col col-md-12">
<hr>
<button type="submit" class="btn btn-primary">Simpan</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- next -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="<?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="<?php echo base_url()?>assets/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url()?>assets/js/sweetalert.min.js"></script>
<script>
$(document).ready(function() {
$('#tabeldata').DataTable();
} );
</script>
<script>
const element = document.querySelectorAll('#btn_hapus')
element.forEach(function(el){
el.addEventListener('click', function (e) {
e.preventDefault();
var urlToRedirect = e.currentTarget.getAttribute('href'); //use currentTarget because the click may be on the nested i tag and not a tag causing the href to be empty
console.log(urlToRedirect); // verify if this is the right URL
swal({
title: "Kamu yakin ?",
text: "Data yang dihapus tidak bisa dikembalikan.",
icon: "warning",
buttons: [
'Batal',
'Hapus'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Berhasil',
text: 'Data berhasil terhapus',
icon: 'success'
}).then(function() {
window.location.href = urlToRedirect;
});
} else {
swal("Batal", "Data tidak terhapus.)", "error");
}
});
});
});
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

View File

@ -1,11 +1,11 @@
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 15, 2021 at 03:25 PM
-- Server version: 10.4.21-MariaDB
-- PHP Version: 7.4.23
-- Generation Time: Sep 16, 2021 at 10:36 AM
-- Server version: 10.4.16-MariaDB
-- PHP Version: 7.4.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
@ -18,7 +18,7 @@ SET time_zone = "+00:00";
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_umkm2_test`
-- Database: `db_umkm2`
--
-- --------------------------------------------------------
@ -133,7 +133,7 @@ INSERT INTO `tb_absensi` (`id_absensi`, `id_absen`, `id_umkm`, `id_pemilik`, `ke
(166, '46', '2', '2', '', '', 0, 0, 0, 0, '12', '2020', 1),
(167, '46', '3', '2', '', '', 0, 0, 0, 0, '12', '2020', 1),
(168, '46', '4', '6', '', '', 0, 0, 0, 0, '12', '2020', 1),
(173, '48', '1', '2', 'Magelang Utara', 'Kramat Utara', 100000000, 0, 20, 8, '1', '2021', 0),
(173, '48', '1', '2', 'Magelang Utara', 'Kramat Utara', 100000000, 5000000, 20, 8, '1', '2021', 1),
(174, '48', '2', '2', 'Magelang Selatan', 'Tidar Selatan', 30000000, 0, 30, 12, '1', '2021', 0),
(175, '48', '3', '2', 'Magelang Selatan', 'Rejowinangun Selatan', 5000000, 0, 5, 8, '1', '2021', 0),
(176, '48', '4', '6', 'Magelang Tengah', 'Cacaban', 10000000, 0, 3, 6, '1', '2021', 0);
@ -237,6 +237,20 @@ INSERT INTO `tb_laporan` (`id_laporan`, `tahun`, `jml_umkm`, `total_aset`, `tota
-- --------------------------------------------------------
--
-- Table structure for table `tb_produk`
--
CREATE TABLE `tb_produk` (
`id_produk` bigint(20) NOT NULL,
`foto_produk` text NOT NULL,
`id_umkm` bigint(20) NOT NULL,
`produk` varchar(50) NOT NULL,
`deskripsi` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `tb_umkm`
--
@ -264,7 +278,7 @@ CREATE TABLE `tb_umkm` (
--
INSERT INTO `tb_umkm` (`id_umkm`, `id_pemilik`, `nama`, `id_kategori`, `kecamatan`, `kelurahan`, `alamat`, `telp`, `id_jenis`, `omset_awal`, `aset_awal`, `karyawan_l`, `karyawan_p`, `deskripsi`, `foto_umkm`) VALUES
(1, '2', 'Meubel Rotan', 1, 'Magelang Utara', 'Kramat Utara', 'Jl. Jeruk Purut, Kupatan, Kramat Utara, Magelang', '08121212121', 1, 25000000, 100000000, 20, 8, 'Sedia berbagai furnitur dan Meubel', '1.png'),
(1, '2', 'Meubel Rotan', 1, 'Magelang Utara', 'Kramat Utara', 'Jl. Jeruk Purut, Kupatan, Kramat Utara, Magelang', '08121212121', 1, 25000000, 100000000, 20, 8, 'Sedia berbagai furnitur dan Meubel', '1.jpg'),
(2, '2', 'Percetakan Jaya Muya', 1, 'Magelang Selatan', 'Tidar Selatan', 'Kiringan III, Tidar Selatan, Kota Magelang', '0811111111', 2, 15000000, 30000000, 30, 12, 'Jasa Reklame, Baliho, Banner dan Printing Sepanduk', 'umkm.png'),
(3, '2', 'Frozen Food Magelang', 1, 'Magelang Selatan', 'Rejowinangun Selatan', 'Tanon, Jl. Singosari, Rejowinangun Selatan, Magelang', '08121212121', 2, 12000000, 5000000, 5, 8, 'Reseller Produk makanan beku : Sosis, Daging, Tempura, Nuget, dll', 'umkm.png'),
(4, '6', 'Putih Abu Workshop', 1, 'Magelang Tengah', 'Cacaban', 'Cacaban Tengah', '+6233333923', 3, 16000000, 10000000, 3, 6, 'Souvenir Nikah Karakter', 'umkm.png');
@ -296,7 +310,7 @@ CREATE TABLE `tb_user` (
INSERT INTO `tb_user` (`id_user`, `nama`, `username`, `password`, `alamat_user`, `kecamatan_user`, `kelurahan_user`, `kota_user`, `telp_user`, `npwp`, `foto_user`, `level`) VALUES
(1, 'Admin', 'admin', '643ed2bde5b2f6bd70f7f32a9b0f4ebb', 'Kota Magelang', 'Magelang Selatan', '', 'Kota Magelang', '', '', 'user.png', 'admin'),
(2, 'Yoga Ismail Pratama', 'yogaismail', '81dc9bdb52d04dc20036dbd8313ed055', 'Magelang', 'Magelang Selatan', 'Tidar Selatan', 'Kota Magelang', '0812222999383', '6343266', 'user.png', 'pemilik'),
(2, 'Yoga Ismail Pratama', 'yogaismail', '643ed2bde5b2f6bd70f7f32a9b0f4ebb', 'Magelang', 'Magelang Selatan', 'Tidar Selatan', 'Kota Magelang', '0812222999383', '6343266', 'user.png', 'pemilik'),
(6, 'Prawira Setia ', 'prawira', '643ed2bde5b2f6bd70f7f32a9b0f4ebb', 'Jambe Wangi', 'Magelang Selatan', 'Kramat Utara', 'Kota Magelang', '082689625495', '', 'user.png', 'pemilik');
--
@ -343,6 +357,14 @@ ALTER TABLE `tb_kelurahan`
ALTER TABLE `tb_laporan`
ADD PRIMARY KEY (`id_laporan`);
--
-- Indexes for table `tb_produk`
--
ALTER TABLE `tb_produk`
ADD PRIMARY KEY (`id_produk`),
ADD KEY `id_umkm` (`id_umkm`),
ADD KEY `produk` (`produk`);
--
-- Indexes for table `tb_umkm`
--
@ -399,11 +421,17 @@ ALTER TABLE `tb_kelurahan`
ALTER TABLE `tb_laporan`
MODIFY `id_laporan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tb_produk`
--
ALTER TABLE `tb_produk`
MODIFY `id_produk` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `tb_umkm`
--
ALTER TABLE `tb_umkm`
MODIFY `id_umkm` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
MODIFY `id_umkm` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `tb_user`