<commit_before><?php

use backend\models\Project;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\ActiveForm;
use yii\base\Widget;
use yii\widgets\LinkPager;

$baseUrl = \Yii::getAlias('@web');

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'โครงการ';
$this->params['breadcrumbs'][] = $this->title;

include 'extend.php';

$str = <<<EOT

	$('.project-detail').click(function(){
		var name = $(this).attr('project-name');
		var description = $(this).attr('project-description');
		var startDate = $(this).attr('project-start-date');
		var endDate = $(this).attr('project-end-date');
		var projectType = $(this).attr('project-project-type');
		var status = $(this).attr('project-status');
		var createDate = $(this).attr('project-create-date');
		var createBy = $(this).attr('project-create-by');
		var project = $(this).attr('project');
		$('.modal-title').text(name);
		$('#modal-description').text(description);
		$('#modal-start-date').text(startDate);
		$('#modal-end-date').text(endDate);
		$('#modal-project-type').text(projectType);
		$('#modal-status').text(status);
		$('#modal-create-date').text(createDate);
		$('#modal-create-by').text(createBy);
		$('.modal').modal('show');
	})

	var alert = $alert;
	lenderAlert(alert);		
	function lenderAlert(alert){
		if(alert == 1){
			lenderAlert = "<div class=\"alert alert-success alert-dismissible\">"+
						  "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>"+
						  "Success alert preview. This alert is dismissable."+"</div>";
		}else if(alert == 0){
			lenderAlert = "<div class=\"alert alert-danger alert-dismissible\">"+
						  "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>"+
						  "Danger alert preview. This alert is dismissable."+"</div>";
		}else{
			lenderAlert = "";
		}
		$('#alert').html(lenderAlert);
		$('#alert').show;
		setTimeout(function() { $('#alert').hide(); }, 5000);
	};
EOT;

$this->registerJs($str, View::POS_LOAD, 'form-js');

?>
<div class="project-index">
	<span id="alert"></span>
    <p align="right">
        <?= Html::a('<i class="fa fa-plus"></i> สร้างโครงการ', ['create'], ['class' => 'btn btn-success','style'=>'text-align: right;']) ?>
    </p>
   	<div class="site-index">
	<div class="box box-solid">
		<div class="box-header with-border">
		<?php $form = ActiveForm::begin(); ?>
			<div class="row">
				<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">ชื่อโครงการ</span>
						<?php echo Html::textInput('name', $name, ['id'=> 'project_name', 'class'=> 'form-control', 'placeholder'=> 'ชื่อโครงการ', 'onchange'=>'this.form.submit()']);?>
					</div>
				</div>
				
				<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">สถานะ</span>
							<?php echo Html::dropDownList('status', $status, [0=>'ทั้งหมด']+ Project::$arrSendStatus , ['id'=> 'status', 'class'=> 'form-control','onchange'=>'this.form.submit()'])?>
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">จัดเรียง</span>
						<?php echo Html::dropDownList('sort', $sort,  Project::$arrSort , ['id'=> 'sort', 'class'=> 'form-control' ,'onchange'=>'this.form.submit()'])?>
					</div>
					</div>
					<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">ตำแหน่ง</span>
						<?php echo Html::dropDownList('type', $type,[0=>'ทั้งหมด']+ Project::$arrType, ['id'=> 'type', 'class'=> 'form-control', 'placeholder'=> 'ตำแหน่ง', 'onchange'=>'this.form.submit()']);?>
					</div>
				</div>
			</div>
		<?php ActiveForm::end(); ?>
		</div>
	</div>
	<?php $count = 0; 
	if($value != null):?>
	<?php foreach ($value as $field):?>
	<?php $count++; ?>
	<?php if($count == 1){?>
		<div class="row">
		<?php } ?>
			<div class="col-md-4">
				<div class="box box-solid">
				<a href="javascript:;" title="เข้าสู่งานในโครงการ">  
					<div class="box-header with-border box-height">
						<table style="width:100%" class="col-md-12">
							<tr>
								<td >
									<small class="text-muted">
										<?php 
										$date1 =0;
										$date2 =0;
										if($arrdate1[(string)$field->_id] != 0 ):
										$date1=($arrdate2[(string)$field->_id]/$arrdate1[(string)$field->_id])*100;
										
										endif;
										if ($arrtask1[(string)$field->_id] != 0):
											$date2 =($arrtask2[(string)$field->_id]/$arrtask1[(string)$field->_id])*100;
										endif;
										
										echo "ผู้สร้าง"." : ".$arrUser[(string)$field->create_by]."   วัน  :".(int)$date1."   งาน  :".(int)$date2; ?>
									</small>
								</td>
								<td align="right">
									<span ><?php echo $lebel[$field->status]; ?></span>
								</td>
							</tr>
						</table>
						<div class="text-left">
						<?php if($arrdate1[(string)$field->_id] == 0):
							 ?><font>
						 <?php elseif($arrtask1[(string)$field->_id] == 0):
							 ?><font>
						<?php elseif(($arrdate2[(string)$field->_id]/$arrdate1[(string)$field->_id])*100 
								< 
								($arrtask2[(string)$field->_id]/$arrtask1[(string)$field->_id])*100):
							 ?><font>
						<?php 
							elseif ((($arrdate2[(string)$field->_id]/$arrdate1[(string)$field->_id])*100)/2 
									<= 
									($arrtask2[(string)$field->_id]/$arrtask1[(string)$field->_id])*100):
							?><font color="orange">
						<?php 
						else:
						?>
						<font color="red">
						<?php endif;?>
						
						
								<?php echo $field->project_name; ?></font>
						</div>
						<div class="pull-right text-muted">
							<small>
								<?php echo "วันที่สิ้นสุด"." : ".date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->end_date["sec"])); ?>
							</small>
						</div>
					</div></a>
					<div class="box-body-height">
						<div class="">
							<div class="text-right">
								<a href="javascript:;" class="project-detail" 
									project-name="<?=$field->project_name?>"
									project-description="<?=$field->description?>"
									project-start-date="<?=date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->start_date["sec"]));?>"
									project-end-date="<?=date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->end_date["sec"]))?>"
									project-project-type="<?php echo $arrCategory[(string)$field->category];?>"
									project-status="<?php echo Project::$arrSendStatus[$field->status]; ?>"
									project-create-date="<?=date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->create_date["sec"]));?>"
									project-create-by="<?php echo $arrUser[(string)$field->create_by];?>"
									title="ดูรายละเอียดโครงการ">
									<span>รายละเอียด</span>
									<i class="fa fa-angle-right"></i>&nbsp;
								</a>
							</div>
						</div><commit_msg>progress bar<commit_after><?php

use backend\models\Project;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\ActiveForm;
use yii\base\Widget;
use yii\widgets\LinkPager;

$baseUrl = \Yii::getAlias('@web');

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'โครงการ';
$this->params['breadcrumbs'][] = $this->title;

include 'extend.php';

$str = <<<EOT

	$('.project-detail').click(function(){
		var name = $(this).attr('project-name');
		var description = $(this).attr('project-description');
		var startDate = $(this).attr('project-start-date');
		var endDate = $(this).attr('project-end-date');
		var projectType = $(this).attr('project-project-type');
		var status = $(this).attr('project-status');
		var createDate = $(this).attr('project-create-date');
		var createBy = $(this).attr('project-create-by');
		var project = $(this).attr('project');
		$('.modal-title').text(name);
		$('#modal-description').text(description);
		$('#modal-start-date').text(startDate);
		$('#modal-end-date').text(endDate);
		$('#modal-project-type').text(projectType);
		$('#modal-status').text(status);
		$('#modal-create-date').text(createDate);
		$('#modal-create-by').text(createBy);
		$('.modal').modal('show');
	})

	var alert = $alert;
	lenderAlert(alert);		
	function lenderAlert(alert){
		if(alert == 1){
			lenderAlert = "<div class=\"alert alert-success alert-dismissible\">"+
						  "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>"+
						  "Success alert preview. This alert is dismissable."+"</div>";
		}else if(alert == 0){
			lenderAlert = "<div class=\"alert alert-danger alert-dismissible\">"+
						  "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>"+
						  "Danger alert preview. This alert is dismissable."+"</div>";
		}else{
			lenderAlert = "";
		}
		$('#alert').html(lenderAlert);
		$('#alert').show;
		setTimeout(function() { $('#alert').hide(); }, 5000);
	};
EOT;

$this->registerJs($str, View::POS_LOAD, 'form-js');

?>
<div class="project-index">
	<span id="alert"></span>
    <p align="right">
        <?= Html::a('<i class="fa fa-plus"></i> สร้างโครงการ', ['create'], ['class' => 'btn btn-success','style'=>'text-align: right;']) ?>
    </p>
   	<div class="site-index">
	<div class="box box-solid">
		<div class="box-header with-border">
		<?php $form = ActiveForm::begin(); ?>
			<div class="row">
				<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">ชื่อโครงการ</span>
						<?php echo Html::textInput('name', $name, ['id'=> 'project_name', 'class'=> 'form-control', 'placeholder'=> 'ชื่อโครงการ', 'onchange'=>'this.form.submit()']);?>
					</div>
				</div>
				
				<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">สถานะ</span>
							<?php echo Html::dropDownList('status', $status, [0=>'ทั้งหมด']+ Project::$arrSendStatus , ['id'=> 'status', 'class'=> 'form-control','onchange'=>'this.form.submit()'])?>
					</div>
				</div>
				<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">จัดเรียง</span>
						<?php echo Html::dropDownList('sort', $sort,  Project::$arrSort , ['id'=> 'sort', 'class'=> 'form-control' ,'onchange'=>'this.form.submit()'])?>
					</div>
					</div>
					<div class="col-md-3">
					<div class="input-group">
						<span class="input-group-addon label-gray">ตำแหน่ง</span>
						<?php echo Html::dropDownList('type', $type,[0=>'ทั้งหมด']+ Project::$arrType, ['id'=> 'type', 'class'=> 'form-control', 'placeholder'=> 'ตำแหน่ง', 'onchange'=>'this.form.submit()']);?>
					</div>
				</div>
			</div>
		<?php ActiveForm::end(); ?>
		</div>
	</div>
	<?php $count = 0; 
	if($value != null):?>
	<?php foreach ($value as $field):?>
	<?php $count++; ?>
	<?php if($count == 1){?>
		<div class="row">
		<?php } ?>
			<div class="col-md-4">
				<div class="box box-solid">
				<a href="javascript:;" title="เข้าสู่งานในโครงการ">  
					<div class="box-header with-border box-height">
						<table style="width:100%" class="col-md-12">
							<tr>
								<td >
									<small class="text-muted">
										<?php 
										$date1 =0;
										$date2 =0;
										if($arrdate1[(string)$field->_id] != 0 ):
										$date1=($arrdate2[(string)$field->_id]/$arrdate1[(string)$field->_id])*100;
										
										endif;
										if ($arrtask1[(string)$field->_id] != 0):
											$date2 =($arrtask2[(string)$field->_id]/$arrtask1[(string)$field->_id])*100;
										endif;
										
										echo "ผู้สร้าง"." : ".$arrUser[(string)$field->create_by]."   วัน  :".(int)$date1."   งาน  :".(int)$date2; ?>
									</small>
								</td>
								<td align="right">
									<span ><?php echo $lebel[$field->status]; ?></span>
								</td>
							</tr>
						</table>
						<div class="text-left">
						<?php if($arrdate1[(string)$field->_id] == 0):
							 ?><font>
						 <?php elseif($arrtask1[(string)$field->_id] == 0):
							 ?><font>
						<?php elseif(($arrdate2[(string)$field->_id]/$arrdate1[(string)$field->_id])*100 
								< 
								($arrtask2[(string)$field->_id]/$arrtask1[(string)$field->_id])*100):
							 ?><font>
						<?php 
							elseif ((($arrdate2[(string)$field->_id]/$arrdate1[(string)$field->_id])*100)/2 
									<= 
									($arrtask2[(string)$field->_id]/$arrtask1[(string)$field->_id])*100):
							?><font color="orange">
						<?php 
						else:
						?>
						<font color="red">
						<?php endif;?>
						
						
								<?php echo $field->project_name; ?></font>
								
							<div class="progress-group">
										<small>
                   							 <span class="progress-text">progress</span>
                   						 	 <span class="progress-number"><?php echo $date2;?></span>
                   						</small>
                    				<div class="progress sm">
                   				   		<div class="progress-bar progress-bar-aqua" style="width: <?php echo $date2;?>%"></div>
                   					</div>
                 			</div>
						</div>
						<div class="pull-right text-muted">
							<small>
								<?php echo "วันที่สิ้นสุด"." : ".date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->end_date["sec"])); ?>
							</small>
						</div>
								
					</div></a>
					<div class="box-body-height">
						<div class="">
							<div class="text-right">
								<a href="javascript:;" class="project-detail" 
									project-name="<?=$field->project_name?>"
									project-description="<?=$field->description?>"
									project-start-date="<?=date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->start_date["sec"]));?>"
									project-end-date="<?=date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->end_date["sec"]))?>"
									project-project-type="<?php echo $arrCategory[(string)$field->category];?>"
									project-status="<?php echo Project::$arrSendStatus[$field->status]; ?>"
									project-create-date="<?=date('d/m/Y H:i:s',  strtotime('+6 Hour',$field->create_date["sec"]));?>"
									project-create-by="<?php echo $arrUser[(string)$field->create_by];?>"
									title="ดูรายละเอียดโครงการ">
									<span>รายละเอียด</span>
									<i class="fa fa-angle-right"></i>&nbsp;
								</a>
							</div>
						</div>
{'fraction_non_alphanumeric': 0.24257774025608556, 'fraction_numerical': 0.010130856901646263, 'mean_word_length': 3.1262699564586356, 'pattern_counts': {'":': 0, '<': 265, '<?xml version=': 0, '>': 355, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7463172', 'n_tokens_mistral': 6474, 'n_tokens_neox': 5098, 'n_words': 804}