Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function listdetailticket_post()
- {
- $username = trim($this->post('username'));
- $ticket_id = trim($this->post('ticket_id'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username kosong.',
- ];
- } elseif ($ticket_id == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Ticket tidak ditemukan.',
- ];
- } else {
- $detail = $this->db->get_where('v_ticket', array('ticket_id' => $ticket_id))->row();
- // List Pendukung
- $daftarHistory = array();
- $this->db->select('*');
- $this->db->from('v_detail_ticket');
- $this->db->where('ticket_id', $ticket_id);
- $this->db->order_by('detail_id', 'desc');
- $listHistory = $this->db->get()->result();
- foreach ($listHistory as $x) {
- if ($x->detail_image != '') {
- $attachment = base_url('ticket/' . $x->detail_image);
- } else {
- $attachment = '';
- }
- if ($x->user_avatar != '') {
- $avatar = base_url('img/icon/' . $x->user_avatar);
- } else {
- $avatar = '';
- }
- $daftarHistory[] = array(
- 'detail_id' => $x->detail_id,
- 'detail_level' => $x->detail_level,
- 'detail_name' => $x->user_name,
- 'detail_level' => $x->user_level,
- 'detail_date_post' => date('d-m-Y', strtotime($x->detail_date_post)),
- 'detail_message' => trim($x->detail_message),
- 'attachment' => $attachment,
- 'avatar' => $avatar,
- );
- }
- $response = [
- 'resp_error' => false,
- 'ticket_id' => $detail->ticket_id,
- 'ticket_subject' => trim($detail->ticket_subject),
- 'ticket_status' => trim($detail->ticket_status),
- 'nama_pemohon' => trim($detail->user_name),
- 'email_pemohon' => trim($detail->user_email),
- 'ticket_date_post' => date('d-m-Y', strtotime($detail->ticket_date_post)),
- 'ticket_update' => date('d-m-Y', strtotime($detail->ticket_date_post)),
- 'data' => [
- "listhistory" => $daftarHistory,
- ],
- ];
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement