Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

adding fixing apps #1

Merged
merged 1 commit into from May 8, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://localhost/system-kdo/';
$config['base_url'] = 'http://localhost/KDO/';
This conversation was marked as resolved by Risyandi

This comment has been minimized.

Copy link
@Risyandi

Risyandi May 8, 2019

Author Owner

setiap berubah lokasi penempatan dilocalhost

/*
|--------------------------------------------------------------------------
@@ -16,6 +16,10 @@ public function index()
$data['motorBaik']=$this->user_m->getCount("Baik", 'tbl_motor');
$data['mobilRusak']=$this->user_m->getCount("Rusak", 'tbl_mobil');
$data['mobilBaik']=$this->user_m->getCount("Baik", 'tbl_mobil');
$data['mServicebengkel']=$this->user_m->getCount("Service Bengkel", 'tbl_mobil');
$data['mServiceatpm']=$this->user_m->getCount("Service ATPM", 'tbl_mobil');
$data['mtrServicebengkel']=$this->user_m->getCount("Service Bengkel", 'tbl_motor');
$data['mtrServiceatpm']=$this->user_m->getCount("Service ATPM", 'tbl_motor');
$this->template->load('template', 'dashboard', $data);
}
}
@@ -42,7 +42,7 @@ public function add() {
} else {
$post = $this->input->post(null, TRUE);
$this->mobil_m->add($post);
if($this->db->affected_rows() > 1) {
if($this->db->affected_rows() > 0) {
echo "<script>
alert('Data berhasil disimpan');
</script>";
@@ -76,9 +76,9 @@ public function edit($id) {
} else {
$post = $this->input->post(null, TRUE);
$this->mobil_m->edit($post);
if($this->db->affected_rows() > 1) {
if($this->db->affected_rows() > 0) {
echo "<script>
alert('Data berhasil disimpan');
alert('Perubahan data berhasil disimpan');
</script>";
} echo "<script>
window.location='".site_url('mobil')."';
@@ -7,30 +7,26 @@ function __construct() {
parent::__construct();
check_not_login();
$this->load->model('motor_m');
$this->load->library('form_validation');
}
public function index() {
$data['row']=$this->motor_m->get();
$this->template->load('template', 'motor/motor_data', $data);
}
public function edit() {
$this->template->load('template', 'motor/motor_form_edit');
}
public function del() {
$id = $this->input->post('id_motor');
$this->motor_m->del($id);
if($this->db->affected_rows() > 0){
echo "<script>alert('Data berhasil dihapus');</script>";
}
echo "<script>window.location='".site_url('motor')."';</script>";
}
public function add() {
$this->load->library('form_validation');
$this->form_validation->set_rules('platnomer', 'Plat Nomer', 'required|is_unique[tbl_motor.plat_no]',
array('is_unique' => '%s sudah terpakai')
);
@@ -55,4 +51,49 @@ public function add() {
</script>";
}
}
public function edit($id) {
$this->form_validation->set_rules('platnomer', 'Plat Nomer', 'required|callback_plotNomor_check');
$this->form_validation->set_rules('nomermesin', 'Nomer Mesin', 'required');
$this->form_validation->set_rules('nomerrangka', 'Nomer Rangka', 'required');
$this->form_validation->set_rules('sektor', 'Sektor', 'required');
$this->form_validation->set_rules('keterangan', 'keterangan', 'required');
// message if required
$this->form_validation->set_message('required', '{field} masih kosong, silahkan isi');
if ($this->form_validation->run() == FALSE) {
$query = $this->motor_m->get($id);
if ($query->num_rows() > 0) {
$data['row'] = $query->row();
$this->template->load('template', 'motor/motor_form_edit', $data);
} else {
echo "<script>
alert('data tidak ditemukan');
window.location='".site_url('motor')."';
</script>";
}
} else {
$post = $this->input->post(null, TRUE);
$this->motor_m->edit($post);
if($this->db->affected_rows() > 0) {
echo "<script>
alert('Perubahan data berhasil disimpan');
</script>";
} echo "<script>
window.location='".site_url('motor')."';
</script>";
}
}
public function plotNomor_check($str){
$post = $this->input->post(null, TRUE);
$query = $this->db->query("SELECT * FROM tbl_motor WHERE id_motor = '$post[idmotor]' AND plat_no != '$post[platnomer]'");
if ($query->num_rows() > 0) {
$this->form_validation->set_message('plotNomor_check', '{field} ini sudah dipakai');
return FALSE;
} else {
return TRUE;
}
}
}
@@ -25,6 +25,18 @@ public function add($post) {
$params['merk_motor'] = $post['merkmotor'] != "" ? $post['merkmotor'] : null;
$params['keterangan'] = $post['keterangan'];
$this->db->insert('tbl_motor', $params);
}
public function edit($post) {
$params['plat_no'] = $post['platnomer'];
$params['no_mesin'] = $post['nomermesin'];
$params['no_rangka'] = $post['nomerrangka'];
$params['sektor'] = $post['sektor'];
$params['tipe_motor'] = $post['tipemotor'] != "" ? $post['tipemotor'] : null;
$params['merk_motor'] = $post['merkmotor'] != "" ? $post['merkmotor'] : null;
$params['keterangan'] = $post['keterangan'];
$this->db->where('id_motor', $post['idmotor']);
$this->db->update('tbl_motor', $params);
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.