chess/resources/views/content/projects/action_approve_helpdesk.blade.php

160 lines
9.3 KiB
PHP
Raw Normal View History

2024-08-29 03:56:32 +00:00
<script>
var url = base_url + 'helpdesk_data';
console.log(url)
$(document).ready(function() {
keyword = $("#keyword").val();
load_data_client(url, keyword);
$("#keyword").on('keyup', function (e) {
if (e.key === 'Enter' || e.keyCode === 13) {
e.preventDefault();
load_data_client(url, $("#keyword").val());
}
});
});
$(document).on('click', '.pagination-wrapper a', function(e){
event.preventDefault();
var page = $(this).attr('href').split('page=')[1];
url = base_url + 'helpdesk_data?page=' + page;
keyword = $("#keyword").val();
load_data_client(url, keyword);
});
function load_data_client(url, keyword) {
$.ajax({
type: 'GET',
url: url,
data: {
keyword : keyword,
},
beforeSend: function () {
znLoadingPage()
},
success: function (response) {
if ( response.rc == 200 ) {
var data = response.data.projects.data;
var links = response.data.paginateLinks;
if ( data.length <= 0 ) {
znLoadingPageEnd()
// znNotif('warning', 'Data Project belum tersedia')
$('#card-project').append(`
<x-other.no_data
messageTitle="Maaf data client saat ini tidak ditemukan."
subMessage=""
/>
`)
return false;
}
// var arr = _.chunk(data, 3);
znLoadingPageEnd()
var html = "";
// arr.forEach(function(items, index) {
html += `<div class="row">`;
// items.forEach(function (value, index) {
data.forEach(function (value, index) {
var url_img = "{{asset('assets/media/logos/no_img.png')}}";
if (value.logo_url) {
url_img = value.logo_url;
}
/* var status_project = '';
if(value.status_id == 1) {
status_project = '<span class="ribbon-inner bg-primary"></span>'+ value.status_project;
} else if(value.status_id == 2) {
status_project = '<span class="ribbon-inner bg-warning"></span>'+ value.status_project;
} else if(value.status_id == 3) {
status_project = '<span class="ribbon-inner bg-success"></span>'+ value.status_project;
} else {
status_project = '<span class="ribbon-inner bg-danger"></span>'+ value.status_project;
}
var due_date = G_formatDate(value.due_date, 'd-M-Y');
var present_due_date = new Date(value.due_date);
var present_start_date = new Date();
var one_day = 1000 * 60 * 60 * 24;
var Result = Math.round(present_due_date.getTime() - present_start_date.getTime()) / (one_day);
var days_overdue = Result>0?parseInt(Result.toFixed(0)):0; */
html += `<div class="col-xl-4 col-lg-6 col-md-6 col-sm-6">
<!--begin::Card-->
<div class="card card-custom gutter-b card-stretch">
<!--begin::Body-->
<div class="card-body pt-4">
<!--begin::User-->
<div class="d-flex align-items-center mb-7">
<!--begin::Pic-->
<div class="flex-shrink-0 mr-4">
<div class="symbol symbol-circle symbol-lg-75">
<img src="`+url_img+`" class="img-thumbnail img-fluid rounded-circle" style="object-fit: contain; object-position: center center;" alt="image" onerror="this.error=null; this.src='{{ asset('assets/media/logos/no_img.png') }}'"/>
</div>
</div>
<!--end::Pic-->
<!--begin::Title-->
<div class="d-flex flex-column">
<a href="#" class="text-dark font-weight-bold text-hover-primary font-size-h4 mb-0">${value.client_name}</a>
</div>
<!--end::Title-->
</div>
<!--end::User-->
<!--begin::Desc-->
<p class="mb-7">${value.address}
<!--...
<a href="javascript:void(0);" class="text-primary text-hover-info pr-1" data-toggle="popover" title="${value.project_name}" data-content="<span class='font-size-sm text-dark'>${value.project_detail}</span>" data-container="body" data-trigger="focus" data-placement="right" data-html="true">Read More</a></p>-->
<!--end::Desc-->
<!--begin::Info-->
<div class="mb-7">
<!--<div class="d-flex justify-content-between align-items-center">
<span class="text-dark-75 font-weight-bolder mr-2">Jumlah Anggota Tim:</span>
<a href="#" class="text-muted text-hover-primary"></a>
</div>
<div class="d-flex justify-content-between align-items-cente my-1">
<span class="text-dark-75 font-weight-bolder mr-2">Due Date:</span>
<a href="#" class="text-muted text-hover-primary"></a>
</div>
<div class="d-flex justify-content-between align-items-center">
<span class="text-dark-75 font-weight-bolder mr-2">Days to Duedate:</span>
<span class="text-muted font-weight-bold"></span>
</div>-->
</div>
<!--end::Info-->
<!--<a href="javascript:;" onclick="loadContent('detailProjects?id=${value.id}', this, event)" class="btn btn-block btn-sm btn-light-success font-weight-bolder text-uppercase py-4">Lihat Informasi Project</a>-->
<a href="javascript:;" onclick="loadContent('detail_approve_helpdesk/${value.id}', this, event)" class="btn btn-block btn-sm btn-light-success font-weight-bolder text-uppercase py-4">Detail Task</a>
</div>
<!--end::Body-->
</div>
<!--end:: Card-->
</div>`;
});
html += `</div>`;
// });
$("#card_client").html(html);
$(".pagination-wrapper").html(links);
$('[data-toggle="popover"]').popover();
KTUtil.scrollTop();
} else {
znLoadingPageEnd()
// notifToast('error', 'Terjadi Kesalahan');
znNotif('error', 'Terjadi Kesalahan');
}
}
}).done(function (msg) {
}).fail(function (msg) {
znLoadingPageEnd()
znNotif('danger', 'Terjadi Kesalahan');
$('#card_client').append(`
<x-other.no_data
messageTitle="Maaf data client saat ini tidak ditemukan."
subMessage=""
/>
`)
});
}
/* function detailTask(id) {
loadContent('detail_helpdesk/'+id, this, event)
} */
</script>