Files
2026-06-13 16:02:07 +10:00

74 lines
2.1 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageKonfirmasiPengerjaan extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelProgress', 'MP');
$this->load->model('ModelService', 'MS');
$this->load->model('ModelOperator', 'MO');
$this->load->model('ModelTeknisi', 'MT');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index()
{
$datKonfirmasi = $this->MP->getViewKonfirmasi();
$datService = $this->MS->getDataService();
$datTeknisi = $this->MT->getDataTeknisi();
$datAdmin = $this->MO->getDataAdminService();
$data = [
'sidebar' => "data konfirmasi service",
'navChild' => "data konfirmasi pengerjaan",
'konfirmasi'=> $datKonfirmasi,
'service' => $datService,
'teknisi' => $datTeknisi,
'admin' => $datAdmin
];
$this->load->view('master/KonfirmasiPengerjaan', $data);
}
public function edit()
{
$method = $this->input->post('method');
$id_progress = $this->input->post('id_progress');
$id_adminservice = $this->input->post('id_adminserviceed');
$status_progress = $this->input->post('status_progressed');
if ($status_progress=="Selesai Check" || $status_progress=="Check Ulang") {
$input = [
'STATUS_PROGRESS' => $status_progress,
'ADMINSERVICE_ID' => $id_adminservice
];
$action = $this->MP->update('progress', $input, 'ID_PROGRESS',$id_progress);
} else {
$input = [
'STATUS_PROGRESS' => $status_progress,
'ADMINSERVICE_ID' => $id_adminservice,
'KONFIRM_PROGRESS' => date('Y-m-d H:i:s')
];
$action = $this->MP->update('progress', $input, 'ID_PROGRESS',$id_progress);
}
if ($action) {
$this->session->set_flashdata('flash', 'ditambah');
redirect('ManageKonfirmasiPengerjaan');
} else {
$this->session->set_flashdata('flashgagal', 'ditambah');
redirect('ManageKonfirmasiPengerjaan');
}
}
}