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

89 lines
2.5 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageUpClaim extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelClaim', 'MC');
$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()
{
$datUpClaim = $this->MC->getViewUpClaim();
$datService = $this->MS->getDataServiceClaim();
$data = [
'sidebar' => "data claim service",
'navChild' => "data claim update",
'upclaim' => $datUpClaim,
'service' => $datService
];
$this->load->view('master/UpClaim', $data);
}
public function edit()
{
$method = $this->input->post('method');
$id_garansi = $this->input->post('id_garansi');
$noser_garansi = $this->input->post('noser_garansied');
$datIDP = $this->MC->getGaransiIDProgress($id_garansi);
if (is_array($datIDP)||is_object($$datIDP)) {
$datIDS = $this->MC->getProgressIDService($datIDP[0]['ID_PROGRESS']);
$updategaransi = [
'NOSER_GARANSI' => $noser_garansi,
'STATUS_GARANSI' => "Selesai Claim",
'SELESAI_GARANSI' => date('Y-m-d H:i:s')
];
$updateprogress = [
'STATUS_PROGRESS' => "Selesai Claim",
'SERVICE_ID' => $datIDS[0]['ID_SERVICE']
];
$inputprogress = [
'STATUS_PROGRESS' => "Re-check Claim"
];
$actiongaransi = $this->MC->update('garansi', $updategaransi, 'ID_GARANSI',$id_garansi);
$actionprogress = $this->MC->update('progress', $updateprogress, 'ID_PROGRESS',$datIDP[0]['ID_PROGRESS']);
$actionnew = $this->MC->create('progress', $inputprogress);
$datProgressService = $this->MS->getIDProgress();
if (is_array($datProgressService)||is_object($$datProgressService)) {
$updateservice = [
'PROGRESS_ID' => $datProgressService[0]['ID_PROGRESS']
];
$actionservice = $this->MC->update('service', $updateservice, 'ID_SERVICE',$datIDS[0]['ID_SERVICE']);
}
}
if ($actionservice) {
$this->session->set_flashdata('flash', 'diproses');
redirect('ManageUpClaim');
} else {
$this->session->set_flashdata('flashgagal', 'diproses');
redirect('ManageUpClaim');
}
}
}