master
SuraMew 2025-08-30 14:03:57 +07:00
parent fb2a7380f8
commit 8c914a5eb6
2 changed files with 36 additions and 24 deletions

View File

@ -89,7 +89,7 @@ class Tool extends \yii\db\ActiveRecord
'id' => 'ID',
'department_id' => 'หน่วยงาน',
'durable' => 'พัสดุครุภัณฑ์',
'department_in' => 'หน่วยงานที่ขอ',
'department_in' => 'กลุุ่มงาน', //หน่วยงานที่ขอ
'durable_name' => 'ชื่อพัสดุ',
'durable_no' => 'หมายเลขพัสดุ',
'durable_detail' => 'รายละเอียด',
@ -152,7 +152,8 @@ class Tool extends \yii\db\ActiveRecord
/*
* UploadFiles เป็น Method ในการ upload หลายไฟล์ สูงสุด 10 ไฟล์ตามที่ได้กำหนดจาก rules() และจะ return ชื่อไฟล์ aaaa.aaa, bbbb.bbb, ....
*/
public function uploadFiles($model, $attribute){
public function uploadFiles($model, $attribute)
{
$filesName = []; //กำหนดชื่อไฟล์ที่จะ return
$files = UploadedFile::getInstances($model, $attribute);
FileHelper::createDirectory($this->getPath());
@ -190,5 +191,4 @@ class Tool extends \yii\db\ActiveRecord
{
return explode(',', $this->photos);
}
}

View File

@ -13,7 +13,8 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="tool-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?php // echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?= Html::a('เพิ่มข้อมูลเครื่องมืออุปกรณ์', ['create'], ['class' => 'btn btn-success']) ?>
@ -24,18 +25,29 @@ $this->params['breadcrumbs'][] = $this->title;
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'durable',
'department_in',
'durable_name',
'durable_no',
'durable_doc_no',
//'department_id',
[
'attribute' => 'department_id',
'value' => function ($model) {
return isset($model->department) ? $model->department->name : '';
},
],
[
'attribute' => 'department.area_id',
'value' => function ($model) {
return isset($model->department) ? $model->department->area->name : '';
},
],
'department_in',
//'durable_no',
//'durable_doc_no',
'supplier',
'durable_method',
'durable_budget_type',
//'durable_method',
//'durable_budget_type',
'fiscal_year',
'price',
[
'label' => 'Action',
'format' => 'raw',