Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ini view nya:
- <?php
- $form = $this->beginWidget('CActiveForm', array(
- 'id' => 'input-pekerjaan',
- 'enableAjaxValidation' => false,
- ));
- ?>
- <div class="modal-body">
- <table>
- <tr>
- <td>Nama Pengambil</td>
- <td> : </td>
- <td><?php
- $data = array(0 => t('choose', 'global')) + CHtml::listData((User::model()->listPegawai()), 'id', 'name');
- $this->widget('bootstrap.widgets.TbSelect2', array(
- 'asDropDownList' => TRUE,
- 'data' => $data,
- 'name' => 'pegawai',
- 'options' => array(
- "placeholder" => t('choose', 'global'),
- "allowClear" => true,
- ),
- 'htmlOptions' => array(
- 'id' => 'pegawai',
- 'style' => 'width:250px;'
- ),
- ));
- ?></td>
- </tr>
- <tr>
- <td>Kolom</td>
- <td>:</td>
- <td id="Kolom"></td>
- <!-- <input type="hidden" name='idNopot' id="idNopot" value="">
- <input type="hidden" name='workId' id="workId" value="">
- <input type="hidden" name='worksplit' id="worksplit" value="">-->
- <input type="hidden" name='workProccess' id="workProccess" value="">
- <input type="hidden" name='nopot' id="nopot" value="">
- </tr>
- <tr>
- <td>Dari</td>
- <td> : </td>
- <td><?php echo user()->name; ?></td>
- </tr>
- <tr>
- <td>Jumlah Awal</td>
- <td> : </td>
- <td><input type="text" name="jml_awal" class="angka"></td>
- </tr>
- <tr>
- <td>Deskripsi</td>
- <td> : </td>
- <td><textarea name="description"></textarea></td>
- </tr>
- </table>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <?php
- echo CHtml::ajaxSubmitButton('Tambah', Yii::app()->createUrl('workorder/ambilNopot'), array(
- 'type' => 'POST',
- 'success' => 'function(data){
- var id = $("#idNopot").val();
- $("#"+id+"").replaceWith(data);
- $("#createNew").modal("hide");
- }'
- ), array(
- 'class' => 'btn btn-primary',
- )
- );
- ?>
- </div>
- <?php
- $this->endWidget();
- ?>
- ini controller nya:
- public function actionAmbilNopot() {
- // $isi = $_POST['idData'];
- if (isset($_POST['pegawai'])) {
- $model = new WorkorderProcess();
- $model->start_from_user_id = $_POST['pegawai'];
- $model->work_process_id = $_POST['workProccess'];
- $model->workorder_split_id = $_POST['nopot'];
- $model->code = SiteConfig::model()->formatting('workorder_process', false);;
- $model->time_start = date('Y-m-d h:i:s');
- $model->start_user_id = user()->id;
- $model->end_user_id = null;
- $model->start_qty = $_POST['jml_awal'];
- $model->end_qty = 0;
- $model->description = $_POST['description'];
- $model->is_payment = 0;
- $model->charge = 0;
- $model->loss_qty = 0;
- $model->loss_charge = null;
- $model->save();
- }
- echo '<label class="label label-info">Dari : '.$model->StartFromUser->name
- . '<hr style="margin:0px"/><span style="font-size:10px">Mulai:'.$model->time_start
- . '</span></br><span style="font-size:10px">Selesai: - </span></label>';
- echo '<br>';
- echo '<a href="#" data-toggle="modal" class="btn btn-mini">'
- . '<div class="tombol" id="tb[' . $model->work_process_id . ']" pekerja="' . $model->start_from_user_id . '" dari="' . $model->start_user_id . '" penerima="' . $model->end_user_id . '" jml_awal="' . $model->start_qty . '" jml_akhir="' . $model->end_qty . '" loss="' . $model->loss_qty . '" denda="' . $model->loss_charge . '" date_start="' . $model->time_start . '" date_end="' . $model->time_end . '">'
- . '<i class="icon-eye-open"></i></div></a>'
- . '<a href="#" id="yw1" class="btn btn-mini"><i class="icon-pencil" rel="tooltip" title="edit"></i></a>'
- . '<a href="#" id="yw2" class="btn btn-mini"><i class="icon-trash" rel="tooltip" title="hapus"></i></a>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement