<?php use yii\helpers\Html;use yii\helpers\Url;use yii\bootstrap\Modal;use kartik\select2\Select2;use kartik\date\DatePicker;$this->title='Export Stock Out';$this->params['breadcrumbs'][]=$this->title;?><div class="content-page export"><div class="content-page-header"><?=Html::encode($this->title)?></div><div class="content-page-content syncmast-content container-fluid"><div class="form-group"><label>Date</label><?php echo DatePicker::widget([ 'id'=>'date','name'=>'date','pluginOptions'=>[ 'autoclose'=>true,'format'=>'dd-M-yyyy' ] ]);?></div><div class="form-group"><label>Warehouse</label><?php echo Select2::widget([ 'name'=>'warehouse','id'=>'warehouse','data'=>$listWarehouse,'options'=>[ 'placeholder'=>'Pilih Warehouse ...',] ]);?></div><div class="form-group"><label>Account</label><?php echo Select2::widget([ 'name'=>'account','id'=>'account','data'=>$listAccount,'options'=>[ 'placeholder'=>'Pilih Account ...',] ]);?></div><div class="export-button"><button class="btn btn-primary start-export">START EXPORT</button></div><?php Modal::begin([ 'footer'=>'<button class="btn btn-primary btn-submit-modal btn-close-modal">Done</button>','footerOptions'=>['class'=>'syncmast-popup-footer'],'id'=>'modal-success' ]);?><div class="syncmast-popup-content text-center"><i class="syncmast-popup-content-icon material-icons">check_circle_outline</i><div class="syncmast-popup-content-title">Export done</div></div><?php Modal::end();?></div></div><script type="text/javascript">/*<![CDATA[*/function formatDate(b){var f=new Date(b),e=""+(f.getMonth()+1),a=""+f.getDate(),c=""+f.getFullYear();if(e.length<2){e="0"+e}if(a.length<2){a="0"+a}c=c.replace("-","");return[c,e,a].join("-")}function beginExport(){console.log("begin export");date=$("#date").val();if(date){date=formatDate(date)}else{date=""}var d=$("#warehouse").children("option:selected").val();var b=$("#warehouse").children("option:selected").text();var c=$("#account").children("option:selected").val();var a=$("#account").children("option:selected").text();if(d&&c){window.open("<?=Url::to(['export/create-stock-out']);?>?date="+date+"&wh_no="+d+"&wh_name="+b+"&acc_no="+c+"&acc_name="+a)}}$(".start-export").click(function(){beginExport()});/*]]>*/</script>