2024-12-25 03:04:59 +00:00
< ? php
use yii\grid\GridView ;
use yii\helpers\Html ;
use kartik\detail\DetailView ;
use unclead\multipleinput\MultipleInputColumn ;
use unclead\multipleinput\MultipleInput ;
use common\models\ConstServiceCharge ;
use yii\bootstrap5\ActiveForm ;
use yii\helpers\Url ;
use yii\web\JsExpression ;
use yii\jui\AutoComplete ;
$this -> title = 'Staining: ' . $histo_staining -> id_case ;
$this -> params [ 'breadcrumbs' ][] = [ 'url' => '/histo/staining/index' , 'label' => 'Histochemistry Special Staining' ];
$this -> params [ 'breadcrumbs' ][] = $this -> title ;
if ( substr ( $histo_staining -> id_case , 0 , 2 ) == 'AU' ) {
$patient = $model -> patient ;
$hospital = $model -> hospital ;
} else {
$patient = isset ( $model -> patient ) ? $model -> patient : '' ;
$hospital = isset ( $model -> hospital ) ? $model -> hospital : '' ;
}
?>
< ? php //$this->render('/layouts/_menu')
?>
2025-01-21 02:56:57 +00:00
< div class = " card mt-3 " >
< div class = " card-header " >
< h5 class = " card-title " >< i class = " ri-file-text-line " ></ i > < ? = $this -> title ?> </h5>
</ div >
< div class = " card-body " >
< div class = " table-responsive " >
< ? = DetailView :: widget ([
'model' => $histo_staining ,
'condensed' => true ,
'hover' => true ,
'hideAlerts' => true ,
'mode' => DetailView :: MODE_VIEW ,
'panel' => [
'heading' => $this -> title ,
'type' => DetailView :: TYPE_SUCCESS ,
],
'options' => [
'class' => 'table truncate m-0 align-middle dataTable no-footer' , // Custom class for the table
],
'enableEditMode' => false ,
'attributes' => [
[
'columns' => [
[
'attribute' => 'stain_user_id' ,
'label' => 'ผู้รับงาน' ,
'format' => 'raw' ,
'value' => isset ( $histo_staining -> operate ) ? $histo_staining -> operate -> realname /*. '<br />' . $histo_staining['prepare_at']*/ : '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'attribute' => 'send_id' ,
'label' => 'ผู้ส่งงาน' ,
'format' => 'raw' ,
'value' => isset ( $histo_staining -> send ) ? $histo_staining -> send -> realname /*. '<br />' . $histo_staining->out_at*/ : '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
2024-12-25 03:04:59 +00:00
],
2025-01-21 02:56:57 +00:00
],
[
'columns' => [
2024-12-25 03:04:59 +00:00
[
2025-01-21 02:56:57 +00:00
'attribute' => 'id_case' ,
'label' => 'Case ID' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
2024-12-25 03:04:59 +00:00
],
[
2025-01-21 02:56:57 +00:00
'format' => 'raw' ,
'label' => 'พยาธิแพทย์' ,
'value' => isset ( $model -> pathologist ) ? $model -> pathologist -> realname : '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
]
],
[
'columns' => [
2024-12-25 03:04:59 +00:00
[
2025-01-21 02:56:57 +00:00
//'attribute' => 'patientCase.pathologist',
'format' => 'raw' ,
'label' => 'ชื่อ' ,
//'value' => isset($model->patient) ? $model->patient->given_name . ' ' . $model->patient->surname : null,
'value' => isset ( $model -> patient ) ? $model -> patient -> getFullname () : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
2024-12-25 03:04:59 +00:00
],
[
2025-01-21 02:56:57 +00:00
//'attribute' => 'patientCase.pathologist',
'format' => 'raw' ,
'label' => 'โรงพยาบาล' ,
'value' => isset ( $hospital ) ? $hospital -> name . ' ' . Yii :: $app -> pathology -> getPrivate ( $hospital -> is_private ) : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
]
],
[
'columns' => [
[
'label' => 'อายุ' ,
//'value' => isset($model->patient->age) && $model->patient->age > 0 ? $model->patient->age.' '.$model->patient->age_unit : '',
'value' => $model ? ( $model -> age > 0 ? $model -> age . ' ' . $model -> age_unit : '' ) : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
2024-12-25 03:04:59 +00:00
],
2025-01-21 02:56:57 +00:00
[
'label' => ' ' ,
'value' => '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
2024-12-25 03:04:59 +00:00
]
2025-01-21 02:56:57 +00:00
],
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
]
]) ?>
< ? php if ( $prefix = substr ( $histo_staining -> id_case , 0 , 2 ) == 'CS' ) {
$case_consult = Yii :: $app -> pathology -> getCase ( $histo_staining -> id_case );
?>
< table class = " table mb-3 " >
< tr >
< th > Block ภายนอก </ th >
< td >< ? = $case_consult -> block_ex ?> </td>
< th > Block ภายใน </ th >
< td >< ? = $case_consult -> block_in ?> </td>
< th > Selected Block </ th >
< td >< ? = $case_consult -> selected_block ?> </td>
< th > จำนวน Block </ th >
< td >< ? = $case_consult -> block_amount ?> </td>
< th > จำนวน Slide </ th >
< td >< ? = $case_consult -> slide_amount ?> </td>
< th > Note </ th >
< td >< ? = $case_consult -> note ?> </td>
</ tr >
< ? php if ( $case_consult -> is_breast == 1 ) { ?>
2024-12-25 03:04:59 +00:00
< tr >
< th > Request </ th >
< td >< ? = isset ( $case_consult -> stainingTest ) ? $case_consult -> stainingTest -> test : null ?>
</ td >
</ tr >
< ? php } ?>
2025-01-21 02:56:57 +00:00
</ table >
< ? php } ?>
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< ? php if ( $prefix = substr ( $histo_staining -> id_case , 0 , 2 ) == 'EX' ) {
$case_staining = Yii :: $app -> pathology -> getCase ( $histo_staining -> id_case );
?>
< table class = " table mb-3 " >
< tr >
< th > Block ภายนอก </ th >
< td >< ? = isset ( $case_staining -> block_ex ) ? $case_staining -> block_ex : null ?> </td>
< th > Block ภายใน </ th >
< td >< ? = isset ( $case_staining -> block_in ) ? $case_staining -> bloc_in : null ?> </td>
< th > จำนวน Block </ th >
< td >< ? = $case_staining -> block_amount ?> </td>
< th > จำนวน Slide </ th >
< td >< ? = $case_staining -> slide_amount ?> </td>
< th > Note </ th >
< td >< ? = $case_staining -> note ?> </td>
</ tr >
</ table >
< ? php } ?>
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< h6 class = " mt-3 " >< i class = " ri-arrow-right-s-fill " ></ i > Immuno Staining </ h6 >
< ? = GridView :: widget ([
'tableOptions' => [ 'class' => 'table table-striped truncate m-0' ],
'layout' => " { summary}<div class='table-outer'><div class='table-responsive'> \n { items} \n </div></div><div class='d-flex justify-content-between align-items-center mt-4'> { pager}</div> " ,
'dataProvider' => $immuno ,
'summary' => false ,
'columns' => [
[ 'class' => 'yii\grid\SerialColumn' ],
'block_no' ,
'financeServiceCharge.charge.code' ,
[
'attribute' => 'financeServiceCharge.charge.name' ,
'label' => 'ชื่อรายการย้อม Immuno'
],
'note' ,
'financeServiceCharge.price' ,
'in_at' ,
'receive_at' ,
'send_at'
]
]) ?> <br />
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< h6 >< i class = " ri-arrow-right-s-fill " ></ i > Special Staining </ h6 >
< ? php $this -> registerJs ( '
2024-12-25 03:04:59 +00:00
$ . fn . init_charge = function (){
var cid = $ ( this ) . attr ( " id " );
var charge_id = $ ( this ) . val ();
var hospital_id = $ ( " #hospital_id " ) . val ();
var sid = cid . split ( " - " );
//alert(charge_id);
$ . 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 ]);
}
);
};
' ) ?>
2025-01-21 02:56:57 +00:00
< ? php $form = ActiveForm :: begin () ?>
< ? = Html :: hiddenInput ( 'hospital_id' , $hospital -> id , [ 'id' => 'hospital_id' ]) ?>
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< ? = $form -> field ( $histo_staining , 'items' ) -> label ( false ) -> widget ( MultipleInput :: class , [
'max' => 50 ,
'allowEmptyList' => true ,
//'min' => 1,
'id' => Html :: getInputId ( $histo_staining , 'items' ),
'addButtonOptions' => [ 'class' => 'btn btn-primary' ],
'addButtonPosition' => MultipleInput :: POS_FOOTER ,
'attributeOptions' => [],
'columns' => [
[
'name' => 'id_case' ,
'title' => 'ID Case' ,
'value' => function ( $data ) {
return isset ( $data [ 'id_case' ]) ? $data [ 'id_case' ] : null ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'id' ]) ? $data [ 'id' ] : null ;
},
'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' ] : null ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'block_no' ,
'title' => 'Block No.' ,
'enableError' => 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' ] : null ;
},
],
[
'name' => 'finance_code' ,
'title' => 'ลงรายการย้อม Histo' ,
'type' => AutoComplete :: class ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'code' ]) ? $data [ 'finance' ][ 'charge' ][ 'code' ] : null ;
},
'enableError' => true ,
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
'options' => [
'options' => [
'class' => 'form-control'
],
'clientOptions' => [
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
'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_charge();}' ,
'select' => new JsExpression ( " function( event, ui ) {
2024-12-25 03:04:59 +00:00
$ ( this ) . val ( ui . item . id );
$ ( this ) . init_charge ();
} " )
],
2025-01-21 02:56:57 +00:00
'class' => 'charge_class' ,
//
//'prompt' => 'เลือกค่าตัด',
//'onchange' => '$(this).init_charge();'
2024-12-25 03:04:59 +00:00
]
2025-01-21 02:56:57 +00:00
],
[
'name' => 'testing' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'ชื่อรายการย้อมHisto' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'name' ]) ? $data [ 'finance' ][ 'charge' ][ 'name' ] : null ;
},
'enableError' => true ,
],
[
'name' => 'note' ,
'title' => 'Note' ,
'enableError' => true ,
],
[
'name' => 'price' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Price' ,
'value' => function ( $data ) use ( $model , $hospital ) {
return number_format ( Yii :: $app -> pathology -> getHosPrice ( isset ( $model -> hospital_id ) ? $model -> hospital_id : null , ( isset ( $data [ 'finance' ]) ? $data [ 'finance' ][ 'charge_id' ] : null )), 2 );
},
'enableError' => true ,
],
[
'name' => 'is_able' ,
'title' => 'Dis.' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_CHECKBOX ,
],
[
'name' => 'disable_comment' ,
'title' => 'Comment' ,
'enableError' => true ,
],
[
'name' => 'in_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'วันสั่งย้อม' ,
'enableError' => true ,
],
[
'name' => 'prepare_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'วันรับงาน' ,
'enableError' => true ,
],
[
'name' => 'out_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'วันส่งงาน' ,
'enableError' => true ,
],
]
]) ?>
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< ? = Html :: submitButton ( 'บันทึกข้อมูล' , [ 'class' => 'btn btn-primary btn-block' ]) ?>
< ? = Html :: submitButton ( 'Update' , [ 'class' => 'btn btn-warning btn-block' , 'value' => 'update' , 'name' => 'update' ]) ?>
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< ? php ActiveForm :: end () ?>
< ? php //var_dump($items)
?>
2024-12-25 03:04:59 +00:00
2025-01-21 02:56:57 +00:00
< ? php $this -> registerJs ( "
2024-12-25 03:04:59 +00:00
$ ( '#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);#histostaining-items-0-from_id
var id_case = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"histostaining-items-\"]' ) . val ();
var from_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"histostaining-items-\"][id$=\"-id\"]' ) . val ();
//alert(id_case + from_id);
$ . post ( \ " " . Url :: to ([ '/histo/staining/finance-service-charge-delete' ]) . " \" ,
{
id_case : id_case ,
from_id : from_id
},
function ( data , status ){
//alert(\"Data: \" + data + \"Status: \" + status);
}
);
});
" ) ?>
</ div >
</ div >
</ div >
2025-01-21 02:56:57 +00:00
< div class = " card mt-3 " >
2024-12-25 03:04:59 +00:00
< div class = " card-header " >
< div class = " header-top " >
2025-01-21 02:56:57 +00:00
< h5 class = " card-title " >< i class = " ri-file-list-3-line " ></ i > < ? = $this -> title ?> </h5>
2024-12-25 03:04:59 +00:00
</ div >
< div class = " card-body " >
< ? php if ( $histo_staining -> in_at ) { ?>
2025-01-21 02:56:57 +00:00
< embed src = " <?= Url::to(['request-pdf', 'id_case' => $histo_staining->id_case ], true) ?> "
type = " application/pdf " width = " 100% " height = " 300 " >
2024-12-25 03:04:59 +00:00
< ? php } ?>
</ div >
</ div >
</ div >