/** * @return string */ public function run() { $content = '<span id="' . $this->blockId . '" style="display:none;"><br>'; $content .= \trntv\filekit\widget\Upload::widget($this->originConfig); $js = 'setTimeout(function(){ '; $js .= 'var block = $("#' . $this->blockId . '").detach();'; $js .= '$(\'input[name="' . $this->fieldName . '"]\').parent().append(block);'; $js .= '$("#' . $this->blockId . '").show();'; $js .= '$("#' . $this->blockId . '").change(function(){ setTimeout(function() '; $js .= '{ var src = $("#' . $this->blockId . '").find(\'img\').attr(\'src\'); var content = window.jsoneditorcsseditors[\'' . $this->editorKey . '\'].getEditor(\'' . $this->fieldEditorKey . '\'); content.setValue(src); },2000); });'; $js .= '},3000);'; $content .= '</span>'; $this->view->registerJs($js); return $content; }
?> </p> <?php $form = ActiveForm::begin(); ?> <blockquote> <p>หลังจากอัพโหลดไฟล์เสร็จทุกรายการ กรุณาคลิกบันทึกที่ด้านล่างด้วยครับ..</p> </blockquote> <table class="table table-bordered"> <tbody> <?php $i = 1; foreach ($documents as $index => $document) { echo "<tr><td style='width:30px;text-align:center;'><strong>{$i}</strong></td><td>" . ($document->filename ? '<i style="color:green;" class="glyphicon glyphicon-ok"></i> ' : '') . "{$document->documentType->name}</td><td style='width:80px;'>"; echo \trntv\filekit\widget\Upload::widget(['model' => $document, 'attribute' => "[{$index}]attach_file", 'url' => ['document-upload'], 'sortable' => true, 'maxFileSize' => 10 * 1024 * 1024, 'maxNumberOfFiles' => 1]); echo '</td></tr>'; $i++; } ?> </tbody> </table> <div class="form-group"> <?php echo Html::submitButton('SAVE', ['class' => 'btn btn-yellow btn-lg btn-block']); ?> </div> <?php ActiveForm::end(); ?> </div>