2024-12-25 03:04:59 +00:00
< ? php
use kartik\detail\DetailView ;
use yii\helpers\Html ;
use yii\helpers\Url ;
use unclead\multipleinput\MultipleInput ;
use yii\widgets\ActiveForm ;
use unclead\multipleinput\MultipleInputColumn ;
use yii\web\JsExpression ;
use common\models\ConstServiceCharge ;
use yii\jui\AutoComplete ;
use kartik\icons\Icon ;
$this -> title = 'Pathologist Staining - สั่งย้อมพิเศษ ( Case: ' . $case -> id_case . ' )' ;
?>
< ? php /* DetailView :: widget ([
'model' => $case ,
'condensed' => true ,
'hover' => true ,
'mode' => DetailView :: MODE_VIEW ,
'panel' => [
'heading' => 'ข้อมูลผู้ป่วย (Patient)' ,
'type' => DetailView :: TYPE_SUCCESS ,
],
'enableEditMode' => false ,
'attributes' => [
[
'columns' => [
[
'label' => 'คำนำหน้าชื่อ' ,
'format' => 'raw' ,
'value' => $case -> patient -> title -> name ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => 'ชื่อ นามสกุล' ,
'format' => 'raw' ,
'value' => $case -> patient -> name ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'label' => 'เพศ' ,
'format' => 'raw' ,
'value' => Yii :: $app -> pathology -> getGender ( $case -> patient -> gender ),
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => 'เชื้อชาติ' ,
'format' => 'raw' ,
'value' => $case -> patient -> race ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'label' => 'หมายเลขประจำตัวประชาชน' ,
'format' => 'raw' ,
'value' => $case -> patient -> id_card ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => 'วันเดือนปีเกิด' ,
'format' => 'raw' ,
'value' => $case -> patient -> birthdate ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'label' => 'อายุ' ,
'format' => 'raw' ,
'value' => $case -> patient -> age . ' ' . $case -> patient -> age_unit ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => 'โรงพยาบาล' ,
'format' => 'raw' ,
'value' => isset ( $case -> hospital ) ? $case -> hospital -> name : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'label' => 'H.N.' ,
'format' => 'raw' ,
'value' => $case -> patient -> h_n ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => 'A.N.' ,
'format' => 'raw' ,
'value' => $case -> a_n ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'label' => 'Ward' ,
'format' => 'raw' ,
'value' => isset ( $case -> ward ) ? $case -> ward -> name : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => 'Doctor' ,
'format' => 'raw' ,
'value' => $case -> clinician ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'label' => 'Block Ex' ,
'format' => 'raw' ,
'value' => isset ( $case -> block_ex ) ? $case -> block_ex : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => '' ,
'format' => 'raw' ,
'value' => '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
]
]) */ ?>
< div class = " card " >
< div class = " card-header " >
< h4 class = " card-title " >< i class = " fa fa-search " ></ i > < ? = $this -> title ?> </h4>
< div class = " heading-elements " >
< ul class = " list-inline mb-0 " >
< li >< a data - action = " expand " >< i class = " ft-maximize " ></ i ></ a ></ li >
</ ul >
</ div >
</ div >
< div class = " card-body " >
< ? php $form = ActiveForm :: begin () ?>
< ? php
if ( substr ( $case -> id_case , 0 , 2 ) == 'AU' ) {
$hospital_id = $case -> body -> hospital_id ;
} else {
$hospital_id = $case -> hospital_id ;
}
?>
< ? = Html :: hiddenInput ( 'hospital_id' , $hospital_id , [ 'id' => 'hospital_id' ]) ?>
< div class = " mb-3 " >
< h4 >< i class = " fa fa-tint " ></ i > Histo Staining </ h4 >
< div class = " row " >
< div class = " col-sm-12 " >
< ? php $this -> registerJs ( '
$ ( " #histostaining-items " ) . on ( " afterAddRow " , function ( e ){
//console.log("test");
//var sid = cid.split("--");
});
$ . fn . init_histo_charge = function (){
var cid = $ ( this ) . attr ( " id " );
var charge_id = $ ( this ) . val ();
var hospital_id = $ ( " #hospital_id " ) . val ();
var sid = cid . split ( " - " );
//alert(cid);
$ . get (
" ' . Url::toRoute('/site/hospital-service-charge') . ' " ,
{
charge_id : charge_id ,
hospital_id : hospital_id
},
function ( data )
{
var result = data . split ( " -- " );
//alert(sid);
$ ( " #histostaining-items- " + sid [ 2 ] + " -charge_id " ) . val ( result [ 0 ]);
$ ( " .field-histostaining-items- " + sid [ 2 ] + " -code " ) . text ( result [ 1 ]);
$ ( " .field-histostaining-items- " + sid [ 2 ] + " -testing " ) . text ( result [ 2 ]);
$ ( " .field-histostaining-items- " + sid [ 2 ] + " -price " ) . text ( result [ 3 ]);
}
);
};
' ) ?>
< ? = $form -> field ( $tmp_histo_staining , 'items' ) -> label ( false ) -> widget ( MultipleInput :: class , [
'max' => 50 ,
'allowEmptyList' => true ,
//'min' => 1,
'addButtonPosition' => MultipleInput :: POS_FOOTER ,
'attributeOptions' => [
],
'columns' => [
[
'name' => 'id_case' ,
'title' => 'ID Case' ,
'value' => function ( $data ) {
return isset ( $data [ 'id_case' ]) ? $data [ 'id_case' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'id' ]) ? $data [ 'id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'finance_id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'id' ]) ? $data [ 'finance' ][ 'id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'from_id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'from_id' ]) ? $data [ 'finance' ][ 'from_id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'block_no' ,
'title' => 'Block No.' ,
'enableError' => true ,
/* 'options' => [
'class' => 'form-control' ,
'required' => true ,
], */
],
[
'name' => 'request_type' ,
'title' => 'ID' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'charge_id' ,
'title' => 'ID' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge_id' ]) ? $data [ 'finance' ][ 'charge_id' ] : '' ;
},
],
[
'name' => 'finance_code' ,
'title' => 'สั่งย้อมHisto' ,
'type' => AutoComplete :: class ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'code' ]) ? $data [ 'finance' ][ 'charge' ][ 'code' ] : '' ;
},
'enableError' => true ,
'options' => [
'options' => [
'class' => 'form-control' ,
'required' => true ,
],
'clientOptions' => [
'source' => ConstServiceCharge :: find () -> select ([ 'id as id' , 'code as value' , '(code + \' \' + name) as label' ]) -> where ([ 'lab' => 'histo' ]) -> orderBy ([ 'code' => SORT_ASC ]) -> asArray () -> all (),
'change' => 'function(){$(this).init_histo_charge();}' ,
'select' => new JsExpression ( " function( event, ui ) {
$ ( this ) . val ( ui . item . id );
$ ( this ) . init_histo_charge ();
} " )
],
'class' => 'charge_class' ,
]
],
[
'name' => 'testing' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'ชื่อรายการย้อมHisto' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'name' ]) ? $data [ 'finance' ][ 'charge' ][ 'name' ] : '' ;
},
'enableError' => true ,
],
[
'name' => 'note' ,
'title' => 'Note' ,
'enableError' => true ,
],
[
'name' => 'price' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Price' ,
'value' => function ( $data ) use ( $case ) {
return number_format ( Yii :: $app -> pathology -> getHosPrice ( isset ( $case -> hospital_id ) ? $case -> hospital_id : null , ( isset ( $data [ 'finance' ]) ? $data [ 'finance' ][ 'charge_id' ] : null )), 2 );
},
'enableError' => true ,
],
[
'name' => 'is_able' ,
'title' => 'Dis.' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'value' => function ( $data ) {
return isset ( $data [ 'is_able' ]) && $data [ 'is_able' ] == 1 ? 'Dis.' : '' ;
}
],
[
'name' => 'disable_comment' ,
'title' => 'Comment' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
],
[
'name' => 'in_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Order Date' ,
'enableError' => true ,
],
/* [
'name' => 'receive_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Receive Date' ,
'enableError' => true ,
], */
[
'name' => 'out_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Success Date' ,
'enableError' => true ,
]
]
]) ?>
</ div >
</ div >
< ? php $this -> registerJs ( "
$ ( '#histostaining-items' ) . on ( 'afterInit' , function (){
//console.log('calls on after initialization event');
}) . on ( 'beforeAddRow' , function ( e ) {
//console.log('calls on before add row event');
}) . on ( 'afterAddRow' , function ( e ) {
//console.log('calls on after add row event');
}) . on ( 'beforeDeleteRow' , function ( e , item ){
//console.log(item);
return confirm ( 'คุณแน่ใจนะว่าต้องการลบ?' );
}) . on ( 'afterDeleteRow' , function ( e , item ){
//console.log(item);#immunostaining-items-0-from_id
var id_case = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"histostaining-items-\"]' [ id $ = \ " -id_case \" ]).val();
var from_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"histostaining-items-\"][id$=\"-from_id\"]' ) . val ();
var hs_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"histostaining-items-\"][id$=\"-id\"]' ) . val ();
//alert(id_case + from_id);
$ . post ( \ " " . Url :: to ([ '/cyto/order/finance-service-charge-histo-delete' ]) . " \" ,
{
id_case : id_case ,
from_id : from_id ,
hs_id : hs_id
},
function ( data , status ){
//alert(\"Data: \" + data); // + \"Status: \" + status
}
);
});
" ) ?>
</ div >
< div class = " row " >
2025-06-13 07:44:51 +00:00
< div class = " col-sm-6 " >
< ? = Html :: a ( '<i data-feather="arrpw-left-circle" style="width: 16px; margin-bottom: 5px;"></i><span>' . 'กลับ' , [ '/cyto/pap/process' , 'id_case' => $case -> id_case ], [ 'class' => 'btn btn-sm btn-danger' ]) ?>
</ div >
< div class = " col-sm-6 text-end " >
< ? = Html :: submitButton ( '<i data-feather="save" style="width: 16px; margin-bottom: 5px;"></i><span>' . ' สั่งย้อมพิเศษ' , [ 'class' => 'btn btn-sm btn-warning' ]) ?>
</ div >
2024-12-25 03:04:59 +00:00
</ div >
< ? php ActiveForm :: end () ?>
</ div >
2025-06-13 07:44:51 +00:00
</ div >