2024-12-25 03:04:59 +00:00
< ? php
use yii\helpers\Html ;
use yii\helpers\Url ;
use unclead\multipleinput\MultipleInput ;
use unclead\multipleinput\MultipleInputColumn ;
use yii\web\JsExpression ;
use common\models\ConstServiceCharge ;
use yii\bootstrap5\ActiveForm ;
use yii\jui\AutoComplete ;
$this -> title = 'Pathologist Staining - สั่งย้อมพิเศษ ( Case: ' . Html :: encode ( $case -> id_case ) . ')' ;
?>
< div class = " card shadow " >
< div class = " card-header " >
< h5 class = " card-title " >< ? = $this -> title ?> </h5>
</ 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' ]) ?>
< h5 >< i class = " ri-file-add-fill " ></ i > Special Staining </ h5 >
< div class = " row " >
< div class = " col-sm-12 " >
< div class = " mt-3 " >
< ? 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 ]);
}
);
};
' ) ?>
< div class = " table-responsive " >
< ? = $form -> field ( $tmp_histo_staining , 'items' ) -> label ( false ) -> widget ( MultipleInput :: class , [
'max' => 50 ,
'id' => 'histostaining-items' ,
'allowEmptyList' => true ,
2025-04-20 16:39:46 +00:00
'options' => [
'id' => 'block-input-wrapper' ,
],
2024-12-25 03:04:59 +00:00
//'min' => 1,
'addButtonPosition' => MultipleInput :: POS_FOOTER ,
2024-12-27 07:53:06 +00:00
'addButtonOptions' => [ 'class' => 'btn btn-primary' ],
2024-12-25 03:04:59 +00:00
'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' ]) ? $data [ 'id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'from_id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ]) ? $data [ 'finance' ][ 'from_id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
2025-04-20 16:39:46 +00:00
[
'name' => 'block_no' ,
'title' => 'Block No.' ,
'enableError' => true ,
'options' => [
'class' => 'form-control block-no-input' ,
'data-name' => 'block_no' ,
],
],
/* [
2024-12-25 03:04:59 +00:00
'name' => 'block_no' ,
'title' => 'Block No.' ,
'options' => [ 'class' => 'uppercase-input' ],
//'enableError' => true,
'value' => function ( $data ) {
return strtoupper ( isset ( $data [ 'block_no' ])) ? $data [ 'block_no' ] : '' ;
},
/* 'options' => [
'class' => 'form-control' ,
'required' => true ,
2025-04-20 16:39:46 +00:00
],
], */
2024-12-25 03:04:59 +00:00
[
'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' => 'สั่งย้อม' ,
'type' => AutoComplete :: class ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'code' ]) ? $data [ 'finance' ][ 'charge' ][ 'code' ] : null ;
},
'enableError' => true ,
'options' => [
'options' => [
'class' => 'form-control' ,
'required' => true ,
],
'clientOptions' => [
'source' => ConstServiceCharge :: find () -> select ([ 'id as id' , 'code as value' , 'CONCAT(code, \' \', name) as label' ]) -> where ([ 'lab' => 'special' ]) -> 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' => 'ชื่อรายการย้อม' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ]) ? $data [ 'finance' ][ 'charge' ][ 'name' ] : null ;
},
'enableError' => true ,
],
[
'name' => 'note' ,
'title' => 'Note' ,
'enableError' => true ,
],
2025-04-20 16:00:12 +00:00
[
'name' => 'is_express_dye' ,
'type' => MultipleInputColumn :: TYPE_CHECKBOX ,
'title' => 'ย้อมด่วน' ,
'enableError' => true ,
'options' => [
'class' => 'select-all-checkbox-special' ,
],
],
2024-12-25 03:04:59 +00:00
[
'name' => 'price' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Price' ,
'value' => function ( $data ) use ( $case ) {
return isset ( $data -> finance ) ? number_format ( Yii :: $app -> pathology -> getHosPrice ( isset ( $case -> hospital_id ) ? $case -> hospital_id : null , $data -> finance -> charge_id ), 2 ) : null ;
},
'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.' : '' ) : null ;
}
],
[
'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 >
</ div >
</ div >
2025-04-22 07:26:43 +00:00
< ? php
$this -> registerJs ( " // เมื่อเพิ่มแถวใหม่ในตาราง histostaining-items
$ ( '#histostaining-items' ) . on ( 'afterAddRow' , function ( e , row , currentIndex ) {
// ดึงค่า block_no จากแถวสุดท้าย (ก่อนแถวใหม่)
let lastRowBeforeNew = $ ( '#histostaining-items tbody tr' ) . not ( row ) . last ();
let lastValue = lastRowBeforeNew . find ( '.block-no-input' ) . val ();
2025-04-20 16:39:46 +00:00
2025-04-22 07:26:43 +00:00
// ใส่ค่า block_no นั้นลงในแถวใหม่
$ ( row ) . find ( '.block-no-input' ) . val ( lastValue );
});
2025-04-20 16:39:46 +00:00
2025-04-22 07:26:43 +00:00
// เมื่อมีการเปลี่ยนแปลงค่า block_no
$ ( document ) . on ( 'change' , '.block-no-input' , function () {
// ไม่เปลี่ยนค่าแถวอื่น — แก้เฉพาะแถวที่พิมพ์เท่านั้น
});
" );
2025-04-20 16:39:46 +00:00
?>
2025-04-20 16:00:12 +00:00
< ? php
$this -> registerJs ( "
$ ( document ) . on ( 'change' , '.select-all-checkbox-special' , function () {
var allCheckboxes = $ ( '.select-all-checkbox-special' );
if ( $ ( this ) . is ( ':checked' )) {
allCheckboxes . prop ( 'checked' , true );
} else {
allCheckboxes . prop ( 'checked' , false );
}
});
" );
?>
2024-12-25 03:04:59 +00:00
< ? php
$this -> registerJs ( "
$ ( '.uppercase-input' ) . on ( 'keyup' , function () {
var input = $ ( this );
var value = input . val () . toUpperCase ();
input . val ( value );
});
" );
?>
< ? 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 ([ '/pathologist/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
}
);
});
" ) ?>
< h5 >< i class = " ri-file-add-fill " ></ i > Immuno Staining </ h5 >
< div class = " mt-3 " >
< ? php $this -> registerJs ( '
$ ( " #immunostaining-items " ) . on ( " afterAddRow " , function ( e ){
//console.log("test");
//var sid = cid.split("--");
});
$ . fn . init_immuno_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);
$ ( " #immunostaining-items- " + sid [ 2 ] + " -charge_id " ) . val ( result [ 0 ]);
$ ( " .field-immunostaining-items- " + sid [ 2 ] + " -code " ) . text ( result [ 1 ]);
$ ( " .field-immunostaining-items- " + sid [ 2 ] + " -testing " ) . text ( result [ 2 ]);
$ ( " .field-immunostaining-items- " + sid [ 2 ] + " -price " ) . text ( result [ 3 ]);
}
);
};
' ) ?>
< div class = " table-responsive " >
< ? = $form -> field ( $tmp_immuno_staining , 'items' ) -> label ( false ) -> widget ( MultipleInput :: class , [
'addButtonPosition' => MultipleInput :: POS_HEADER ,
'max' => 50 ,
'id' => 'immunostaining-items' ,
'allowEmptyList' => true ,
2025-04-20 16:39:46 +00:00
'options' => [
'id' => 'block-input-wrapper' ,
],
2024-12-25 03:04:59 +00:00
//'min' => 1,
'addButtonPosition' => MultipleInput :: POS_FOOTER ,
2025-04-01 18:01:30 +00:00
'addButtonOptions' => [ 'class' => 'btn btn-primary' ],
2024-12-25 03:04:59 +00:00
'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' => 'finance_id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'id' ]) ? $data [ 'finance' ][ '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 ,
2025-04-20 16:39:46 +00:00
'options' => [
'class' => 'form-control block-no-input' ,
'data-name' => 'block_no' ,
],
2024-12-25 03:04:59 +00:00
],
[
'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' => 'สั่งย้อม' ,
'type' => AutoComplete :: class ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'code' ]) ? $data [ 'finance' ][ 'charge' ][ 'code' ] : null ;
},
'enableError' => true ,
'options' => [
'options' => [
'class' => 'form-control' ,
'required' => true ,
],
'clientOptions' => [
2025-04-01 15:25:25 +00:00
'source' => ConstServiceCharge :: find () -> select ([ 'id as id' , 'code as value' , 'CONCAT(code, \' \', name) as label' ]) -> where ([ 'lab' => 'immuno' ]) /*->orderBy(['code' => SORT_ASC])*/ -> asArray () -> all (),
2024-12-25 03:04:59 +00:00
'change' => 'function(){$(this).init_immuno_charge();}' ,
'select' => new JsExpression ( " function( event, ui ) {
$ ( this ) . val ( ui . item . id );
$ ( this ) . init_immuno_charge ();
} " )
],
'class' => 'charge_class' ,
]
],
[
'name' => 'testing' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'ชื่อรายการย้อม' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'name' ]) ? $data [ 'finance' ][ 'charge' ][ 'name' ] : null ;
},
'enableError' => true ,
],
[
'name' => 'note' ,
'title' => 'Note' ,
'enableError' => true ,
],
2025-04-20 16:00:12 +00:00
[
'name' => 'is_express_dye' ,
'type' => MultipleInputColumn :: TYPE_CHECKBOX ,
'title' => 'ย้อมด่วน' ,
'enableError' => true ,
'options' => [
'class' => 'select-all-checkbox-ihc' ,
],
],
2024-12-25 03:04:59 +00:00
[
'name' => 'price' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Price' ,
'value' => function ( $data ) use ( $case ) {
//return isset($data->finance) ? number_format(Yii::$app->pathology->getHosPrice(isset($hospital_id) ? $hospital_id : null, $data->finance->charge_id), 2) : null;
return isset ( $data -> finance ) ? number_format ( Yii :: $app -> pathology -> getHosPrice ( isset ( $case -> hospital_id ) ? $case -> hospital_id : null , $data -> finance -> charge_id ), 2 ) : null ;
},
'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.' : '' ) : null ;
}
],
[
'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' => 'send_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Success Date' ,
'enableError' => true ,
]
]
]) ?>
</ div >
</ div >
2025-04-20 16:00:12 +00:00
2025-04-22 07:26:43 +00:00
< ? php
$this -> registerJs ( " // เมื่อเพิ่มแถวใหม่ในตาราง immunostaining-items
$ ( '#immunostaining-items' ) . on ( 'afterAddRow' , function ( e , row , currentIndex ) {
// ดึงค่า block_no จากแถวสุดท้าย (ก่อนแถวใหม่)
let lastRowBeforeNew = $ ( '#immunostaining-items tbody tr' ) . not ( row ) . last ();
let lastValue = lastRowBeforeNew . find ( '.block-no-input' ) . val ();
// ใส่ค่า block_no นั้นลงในแถวใหม่
$ ( row ) . find ( '.block-no-input' ) . val ( lastValue );
});
// เมื่อมีการเปลี่ยนแปลงค่า block_no
$ ( document ) . on ( 'change' , '.block-no-input' , function () {
// ไม่เปลี่ยนค่าแถวอื่น — แก้เฉพาะแถวที่พิมพ์เท่านั้น
});
" );
?>
< ? php /*
2025-04-20 16:39:46 +00:00
$js = <<< JS
// เมื่อแถวใหม่ถูกเพิ่มเข้ามา
$ ( '#immunostaining-items' ) . on ( 'afterAddRow' , function ( e , row , currentIndex ) {
// หาค่าของ .block-no-input ในแถวสุดท้ายก่อนแถวใหม่ (แถวก่อนหน้า)
let lastRowBeforeNew = $ ( '#immunostaining-items tbody tr' ) . not ( row ) . last ();
let lastValue = lastRowBeforeNew . find ( '.block-no-input' ) . val ();
// ใส่ค่าเข้าไปในแถวใหม่
$ ( row ) . find ( '.block-no-input' ) . val ( lastValue );
});
// เมื่อมีการเปลี่ยนแปลงค่าในช่อง .block-no-input
$ ( document ) . on ( 'change' , '.block-no-input' , function () {
// ค่าใหม่ที่ถูกแก้ไข
let changedValue = $ ( this ) . val ();
// อัปเดตค่า block-no-input เฉพาะแถวสุดท้าย (หากต้องการ)
// หรืออัปเดตค่าทั้งหมด ถ้านโยบายต้องให้ sync ทุกช่องเหมือนเดิม
$ ( '#immunostaining-items tbody tr' ) . each ( function ( index , row ) {
$ ( row ) . find ( '.block-no-input' ) . val ( changedValue );
});
});
JS ;
$this -> registerJs ( $js );
2025-04-22 07:26:43 +00:00
*/ ?>
2025-04-20 16:39:46 +00:00
< ? php /*
$js = <<< JS
$ ( '#immunostaining-items' ) . on ( 'afterAddRow' , function ( e , row , currentIndex ) {
let firstInput = $ ( this ) . find ( '.block-no-input' ) . first ();
let newInput = $ ( row ) . find ( '.block-no-input' );
if ( firstInput . length && newInput . length ) {
newInput . val ( firstInput . val ());
}
});
$ ( document ) . on ( 'change' , '.block-no-input' , function () {
// เมื่อมีการเปลี่ยนแปลงค่าในช่องใดช่องหนึ่ง
let changedValue = $ ( this ) . val (); // ค่าใหม่ที่ถูกแก้ไข
let changedIndex = $ ( this ) . closest ( 'tr' ) . index (); // หาค่าตำแหน่งของแถวที่เปลี่ยนแปลง
// คัดลอกค่าไปยังช่องอื่น ๆ
$ ( '#immunostaining-items tbody tr' ) . each ( function ( index , row ) {
if ( index !== changedIndex ) { // ไม่คัดลอกค่าไปยังแถวที่เปลี่ยนแปลง
$ ( row ) . find ( '.block-no-input' ) . val ( changedValue ); // คัดลอกค่าจากช่องที่เปลี่ยนแปลง
}
});
});
// คัดลอกค่าเมื่อแถวใหม่ถูกเพิ่มเข้ามา
$ ( '#block-input' ) . on ( 'afterAddRow' , function ( e , row ) {
let lastInput = $ ( '#immunostaining-items tbody tr' ) . last () . find ( '.block-no-input' ) . val (); // ค่าจากแถวล่าสุด
$ ( row ) . find ( '.block-no-input' ) . val ( lastInput ); // คัดลอกค่าไปยังแถวใหม่
});
JS ;
$this -> registerJs ( $js ); */ ?>
2025-04-20 16:00:12 +00:00
< ? php
$this -> registerJs ( "
$ ( document ) . on ( 'change' , '.select-all-checkbox-ihc' , function () {
var allCheckboxes = $ ( '.select-all-checkbox-ihc' );
if ( $ ( this ) . is ( ':checked' )) {
allCheckboxes . prop ( 'checked' , true );
} else {
allCheckboxes . prop ( 'checked' , false );
}
});
2025-04-20 16:39:46 +00:00
" ); ?>
2025-04-20 16:00:12 +00:00
2024-12-25 03:04:59 +00:00
< ? php $this -> registerJs ( "
2025-04-20 16:39:46 +00:00
$ ( '#immunostaining-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*=\"immunostaining-items-\"][id$=\"-id_case\"]' ) . val ();
var from_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"immunostaining-items-\"][id$=\"-from_id\"]' ) . val ();
var im_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"immunostaining-items-\"][id$=\"-id\"]' ) . val ();
//alert(id_case + from_id + im_id);
$ . post ( \ " " . Url :: to ([ '/pathologist/order/finance-service-charge-immuno-delete' ]) . " \" ,
{
id_case : id_case ,
from_id : from_id ,
im_id : im_id
},
function ( data , status ){
//alert(\"Data: \" + data + \"Status: \" + status);
}
);
});
2024-12-25 03:04:59 +00:00
2025-04-20 16:39:46 +00:00
" ) ?>
2024-12-25 03:04:59 +00:00
2025-04-01 15:25:25 +00:00
<!--
2024-12-25 03:04:59 +00:00
< ? php /*
if ( substr ( $case -> id_case , 0 , 1 ) == 'C' ) { ?>
< h5 >< i class = " ri-file-add-fill " ></ i > Cell Block </ h5 >
< div class = " mt-3 " >
< ? php $this -> registerJs ( '
$ ( " #cellblock-items " ) . on ( " afterAddRow " , function ( e ){
//console.log("test");
//var sid = cid.split("--");
});
$ . fn . init_cellblock_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);
$ ( " #cellblock-items- " + sid [ 2 ] + " -charge_id " ) . val ( result [ 0 ]);
$ ( " .field-cellblock-items- " + sid [ 2 ] + " -code " ) . text ( result [ 1 ]);
$ ( " .field-cellblock-items- " + sid [ 2 ] + " -testing " ) . text ( result [ 2 ]);
$ ( " .field-cellblock-items- " + sid [ 2 ] + " -price " ) . text ( result [ 3 ]);
}
);
};
' ) ?>
< div class = " table-responsive " >
< ? = $form -> field ( $tmp_cell_block_staining , 'items' ) -> label ( false ) -> widget ( MultipleInput :: class , [
'addButtonPosition' => MultipleInput :: POS_HEADER ,
'max' => 50 ,
'id' => 'cellblock-items' ,
'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' ] : 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' => 'finance_id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'id' ]) ? $data [ 'finance' ][ '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' => 'สั่งย้อม' ,
'type' => AutoComplete :: class ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'code' ]) ? $data [ 'finance' ][ 'charge' ][ 'code' ] : null ;
},
'enableError' => true ,
'options' => [
'options' => [
'class' => 'form-control' ,
'required' => true ,
],
'clientOptions' => [
'source' => ConstServiceCharge :: find () -> select ([ 'id as id' , 'code as value' , 'CONCAT(code, \' \', name) as label' ]) -> where ([ 'lab' => 'cyto' ]) -> orderBy ([ 'code' => SORT_ASC ]) -> asArray () -> all (),
'change' => 'function(){$(this).init_cellblock_charge();}' ,
'select' => new JsExpression ( " function( event, ui ) {
$ ( this ) . val ( ui . item . id );
$ ( this ) . init_cellblock_charge ();
} " )
],
'class' => 'charge_class' ,
]
],
[
'name' => 'testing' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'ชื่อรายการย้อม' ,
'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 ( $case ) {
//return isset($data->finance) ? number_format(Yii::$app->pathology->getHosPrice(isset($hospital_id) ? $hospital_id : null, $data->finance->charge_id), 2) : null;
return isset ( $data -> finance ) ? number_format ( Yii :: $app -> pathology -> getHosPrice ( isset ( $case -> hospital_id ) ? $case -> hospital_id : null , $data -> finance -> charge_id ), 2 ) : null ;
},
'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.' : '' ) : null ;
}
],
[
'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' => 'send_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Success Date' ,
'enableError' => true ,
]
]
]) ?>
</ div >
</ div >
< ? php $this -> registerJs ( "
$ ( '#cellblock-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);#cellblock-items-0-from_id
var id_case = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"cellblock-items-\"][id$=\"-id_case\"]' ) . val ();
var from_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"cellblock-items-\"][id$=\"-from_id\"]' ) . val ();
var im_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"cellblock-items-\"][id$=\"-id\"]' ) . val ();
//alert(id_case + from_id + im_id);
$ . post ( \ " " . Url :: to ([ '/pathologist/order/finance-service-charge-cellblock-delete' ]) . " \" ,
{
id_case : id_case ,
from_id : from_id ,
im_id : im_id
},
function ( data , status ){
//alert(\"Data: \" + data + \"Status: \" + status);
}
);
});
" ) ?>
< ? php } else {
} */ ?>
-->
< div class = " row " >
< div class = " col-sm-6 " >
< ? = Html :: a ( 'กลับ' , [ '/pathologist/task/do' , 'id_case' => $case -> id_case ], [ 'class' => 'btn btn-danger' ]) ?>
</ div >
< div class = " col-sm-6 " >
< div class = " text-end " >
< ? = Html :: submitButton ( 'สั่งย้อมพิเศษ' , [ 'class' => 'btn btn-info' ]) ?>
</ div >
</ div >
</ div >
< ? php ActiveForm :: end () ?>
</ div >
</ div >