| Current Path : /var/www/html/dyna-project/views/dashboard/ |
| Current File : /var/www/html/dyna-project/views/dashboard/details.php.20210210 |
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\User;
use yii\helpers\ArrayHelper;
use app\models\Tasks;
use app\models\ParamList;
use app\models\TasksLog;
use app\models\Pic;
$ParamList = new ParamList();
$Tasks = new Tasks();
$User = new User();
$this->registerJs("");
?>
<div class="kt-subheader kt-grid__item" id="kt_subheader">
<div class="kt-container ">
<div class="kt-subheader__main">
<h3 class="kt-subheader__title">Projects Details</h3>
<div class="kt-subheader__breadcrumbs">
<span class="kt-subheader__breadcrumbs-separator"></span>
<span class="kt-subheader__breadcrumbs-link"> Dashboard</span>
<span class="kt-subheader__breadcrumbs-separator"></span>
<span class="kt-subheader__breadcrumbs-link"> Projects Details</span>
</div>
</div>
</div>
</div>
<div class="kt-container kt-grid__item kt-grid__item--fluid">
<div class="row">
<div class="col-sm-3">
<div class="kt-portlet kt-portlet--height-fluid">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">Project Details</h3>
</div>
</div>
<div class="kt-portlet__body p-0">
<div class="kt-portlet__content">
<table class="table table-striped table-borderless">
<tbody>
<tr>
<td>
Project Name<br>
<b><?= $modelProject->name; ?></b>
</td>
</tr>
<tr>
<td>
Start Date<br>
<b><?= date("d M Y", strtotime($modelProject->start_dt)) ?></b>
</td>
</tr>
<tr>
<td>
Due Date<br>
<b><?= date("d M Y", strtotime($modelProject->end_dt)) ?></b>
</td>
</tr>
<?php
if ($modelProject->progress != 'complete') {
?>
<tr>
<td>
Due Days<br>
<b><?= strip_tags($modelProject->getduedays($modelProject->end_dt)); ?></b>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="kt-portlet kt-portlet--height-fluid">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">Staff In-Charge</h3>
</div>
</div>
<div class="kt-portlet__body p-0">
<div class="kt-portlet__content">
<table class="table table-striped table-borderless">
<tbody>
<?php
$modelPic = Pic::find()->where(['project_id' => $modelProject->id])->andwhere(['status' => '1'])->orderBy(['id' => SORT_ASC])->all();
if (!empty($modelPic)) {
foreach ($modelPic as $rowPic) {
echo '<tr><td>' . $ParamList->getlabel(2, $rowPic->role) . '<br><b>' . $User->getusername($rowPic->user_id) . '</b></td></tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="kt-portlet kt-portlet--height-fluid">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">Task Details</h3>
</div>
</div>
<div class="kt-portlet__body p-0">
<div class="kt-portlet__content">
<table class="table table-striped table-borderless">
<thead>
<tr>
<th>Phase</th>
<th width="20%" class="text-center">Total Task</th>
<th width="20%" class="text-center">Task Complete</th>
</tr>
</thead>
<tbody>
<?php
$output = '';
$modelPhase = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['task_type' => 'phase'])
->andwhere(['deleted_status' => '0'])
->orderBy(['task_full_no' => SORT_ASC])
->all();
if (!empty($modelPhase)) {
foreach ($modelPhase as $rowPhase) {
$totalcomplete = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['=', 'parent_id', $rowPhase->id])
->andwhere(['deleted_status' => '0'])
->andwhere(['OR', ['=', 'task_type', 'step'], ['=', 'task_type', 'product']])
->andwhere(['=', 'task_status', 'complete'])
->count();
$totalall = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['=', 'parent_id', $rowPhase->id])
->andwhere(['deleted_status' => '0'])
->andwhere(['OR', ['=', 'task_type', 'step'], ['=', 'task_type', 'product']])
->count();
echo '<tr>
<td>' . $rowPhase->task_name . '</td>
<td class="text-center">' . $totalall . '</td>
<td class="text-center">' . $totalcomplete . '</td>
</tr>';
}
}
$totalcompleteAdhoc = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['deleted_status' => '0'])
->andwhere(['=', 'task_type', 'adhoc'])
->andwhere(['=', 'task_status', 'complete'])
->count();
$totalallAdhoc = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['deleted_status' => '0'])
->andwhere(['=', 'task_type', 'adhoc'])
->count();
if (!empty($totalallAdhoc)) {
$output .= '<tr><td>Adhoc Task</td><td class="text-center">' . $totalallAdhoc . '</td><td class="text-center">' . $totalcompleteAdhoc . '</td></tr>';
}
echo $output;
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php
$modelPhase = Tasks::find()->where(['project_id' => $modelProject->id])->andwhere(['deleted_status' => '0'])->andwhere(['task_type' => 'phase'])->orderBy(['sort' => SORT_ASC])->all();
if (!empty($modelPhase)) {
foreach ($modelPhase as $rowPhase) {
?>
<div class="kt-portlet" data-ktportlet="true">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">
Phase <?= $rowPhase->sort ?> : <?= $rowPhase->task_name ?>
</h3>
</div>
<div class="kt-portlet__head-toolbar">
<div class="kt-portlet__head-group">
<a href="#" data-ktportlet-tool="toggle" class="btn btn-sm btn-icon btn-clean btn-icon-md" aria-describedby="tooltip_mtpb3la6ln"><i class="la la-angle-down"></i></a>
<div class="tooltip tooltip-portlet tooltip bs-tooltip-top" role="tooltip" id="tooltip_mtpb3la6ln" aria-hidden="true" x-placement="top" style="position: absolute; will-change: transform; visibility: hidden; top: 0px; left: 0px; transform: translate3d(440px, -39px, 0px);">
<div class="tooltip-arrow arrow" style="left: 34px;"></div>
<div class="tooltip-inner">Collapse</div>
</div>
</div>
</div>
</div>
<div class="kt-portlet__body p-0">
<?php
$modelStep = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['deleted_status' => '0'])
->andwhere(['task_type' => 'step'])
->andwhere(['parent_id' => $rowPhase->id])
->orderBy(['sort' => SORT_ASC])
->all();
if (!empty($modelStep)) {
echo '<table class="table mb-0 table-bordered table-striped">
<thead>
<tr>
<th scope="col" class="text-center" width="5%">Status</th>
<th scope="col">Task</th>
<th scope="col" width="20%">Assign To</th>
<th scope="col" width="15%">Start Date</th>
<th scope="col" width="15%">Due Date</th>
<th scope="col" class="text-center" width="5%">Log</th>
</tr>
</thead>
<tbody>';
foreach ($modelStep as $rowStep) {
$task_status1 = '';
$bg_color = '';
if ($rowStep->task_status == 'complete')
$task_status1 = '<i class="fas fa-check kt-font-success fa-lg"></i>';
if ($rowStep->task_status == 'on-going') {
if ($rowStep->end_dt > date('Y-m-d'))
$bg_color = 'bg-warning text-white';
else
$bg_color = 'bg-danger text-white';
}
$log = '';
if (TasksLog::find()->where(['task_id' => $rowStep->id])->count() > 0)
$log = '<i class="far fa-sticky-note fa-lg" onclick="displaylog(' . $rowStep->id . ')" style="cursor:pointer;"></i>';
echo '<tr class="' . $bg_color . '">
<td class="text-center">' . $task_status1 . '</td>
<td>' . $rowStep->task_name . '</td>
<td>' . $User->getusername($rowStep->assign_to) . '</td>
<td>' . date("d M Y", strtotime($rowStep->start_dt)) . '</td>
<td>' . date("d M Y", strtotime($rowStep->end_dt)) . '</td>
<td class="text-center">' . $log . '</td>
</tr>';
if ($rowStep->track_type == 'product') {
$modelSubStep = Tasks::find()
->where(['project_id' => $modelProject->id])
->andwhere(['deleted_status' => '0'])
->andwhere(['task_type' => 'product'])
->andwhere(['parent_id' => $rowStep->id])
->orderBy(['sort' => SORT_ASC])
->all();
if (!empty($modelSubStep)) {
foreach ($modelSubStep as $rowSubStep) {
$task_status2 = '';
if ($rowSubStep->task_status == 'complete')
$task_status2 = '<i class="fas fa-check kt-font-success fa-lg"></i>';
$bg_color2 = '';
if ($rowSubStep->task_status == 'on-going') {
if ($rowSubStep->end_dt > date('Y-m-d'))
$bg_color2 = 'bg-warning text-white';
else
$bg_color2 = 'bg-danger text-white';
}
$log2 = '';
if (TasksLog::find()->where(['task_id' => $rowSubStep->id])->count() > 0)
$log2 = '<i class="far fa-sticky-note fa-lg" onclick="displaylog(' . $rowSubStep->id . ')" style="cursor:pointer;"></i>';
echo '<tr class="' . $bg_color2 . '">
<td class="text-center">' . $task_status2 . '</td>
<td><div class="ml-5">' . $Products->getname($rowSubStep->data_id) . '</div></td>
<td>' . $User->getusername($rowSubStep->assign_to) . '</td>
<td>' . date("d M Y", strtotime($rowSubStep->start_dt)) . '</td>
<td>' . date("d M Y", strtotime($rowSubStep->end_dt)) . '</td>
<td class="text-center">' . $log2 . '</td>
</tr>';
}
}
}
}
echo '</tbody></table>';
}
?>
</div>
</div>
<?php
}
}
$modelAdhoc = Tasks::find()->where(['project_id' => $modelProject->id])->andwhere(['deleted_status' => '0'])->andwhere(['task_type' => 'adhoc'])->orderBy(['sort' => SORT_ASC])->all();
if (!empty($modelAdhoc)) {
?>
<div class="kt-portlet" data-ktportlet="true">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">
Adhoc Task
</h3>
</div>
<div class="kt-portlet__head-toolbar">
<div class="kt-portlet__head-group">
<a href="#" data-ktportlet-tool="toggle" class="btn btn-sm btn-icon btn-clean btn-icon-md" aria-describedby="tooltip_mtpb3la6ln"><i class="la la-angle-down"></i></a>
<div class="tooltip tooltip-portlet tooltip bs-tooltip-top" role="tooltip" id="tooltip_mtpb3la6ln" aria-hidden="true" x-placement="top" style="position: absolute; will-change: transform; visibility: hidden; top: 0px; left: 0px; transform: translate3d(440px, -39px, 0px);">
<div class="tooltip-arrow arrow" style="left: 34px;"></div>
<div class="tooltip-inner">Collapse</div>
</div>
</div>
</div>
</div>
<div class="kt-portlet__body p-0">
<table class="table mb-0 table-bordered table-striped">
<thead>
<tr>
<th scope="col" class="text-center" width="5%">#</th>
<th scope="col">Task</th>
<th scope="col" width="20%">Assign To</th>
<th scope="col" width="15%">Start Date</th>
<th scope="col" width="15%">Due Date</th>
<th scope="col" class="text-center" width="5%">Log</th>
</tr>
</thead>
<tbody>
<?php
$countAdhoc = 0;
foreach ($modelAdhoc as $rowAdhoc) {
$countAdhoc++;
$logAdhoc = '';
if (TasksLog::find()->where(['task_id' => $rowAdhoc->id])->count() > 0)
$logAdhoc = '<i class="far fa-sticky-note fa-lg" onclick="displaylog(' . $rowAdhoc->id . ')" style="cursor:pointer;"></i>';
echo '<tr>
<td class="text-center">' . $countAdhoc . '</td>
<td>' . $rowAdhoc->task_name . '</td>
<td>' . $User->getusername($rowAdhoc->assign_to) . '</td>
<td>' . date("d M Y", strtotime($rowAdhoc->start_dt)) . '</td>
<td>' . date("d M Y", strtotime($rowAdhoc->end_dt)) . '</td>
<td class="text-center">' . $logAdhoc . '</td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
<?php } ?>
</div>
<div class="modal fade" id="logModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Task Log</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="kt-timeline-v3">
<div class="kt-timeline-v3__items">
<div id="logcontent"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function displaylog(task_id) {
$.ajax({
url: "index.php?r=taskslog/getlog2",
method: "GET",
data: {"task_id": task_id},
success: function (response) {
$('#logcontent').html(response);
$('#logModal').modal('show');
},
});
}
</script>