type:"GET", dataType:"json", url:xurl, success:function(data){ var x = screen.width/2 - 290/2; var y = screen.height/2 - 400/2; var printWindow = window.open("", "", "height=400,width=290,left="+x+",top="+y); printWindow.document.write(data); printWindow.document.close(); }, error:function(data){ errorMsgBox('An error occured please try again'); } }); } }).find('.btn-primary').removeClass('btn-primary') .addClass('btn-inverse btn-large').css({'margin-right':'265px'}).text('Yes').prev() .addClass('btn-large').text('No').css({'margin-right':'-145px'}) .parent('div').parent('div').css({'margin-top':function(){return ($(this).outerHeight())}}); } </script> <?php // Table gridview untuk menampilkan data member transaction $this->widget('yiiwheels.widgets.grid.WhGridView', array('id' => 'member-grid', 'type' => 'striped bordered', 'dataProvider' => $model->searchPoint(), 'columns' => array(CAdditional::numberColumn(), 'id_member', 'type_card', 'first_name', 'email', 'point', array('header' => 'Action', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center, 'class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{print}', 'buttons' => array('print' => array('label' => 'Print', 'icon' => 'icon-print', 'url' => 'Yii::app()->createUrl("/report/ViewMemberPoint/print",array("id_member"=>$data->id_member))', 'click' => 'function(e){ e.preventDefault(); cetakStruk($(this).attr(\'href\')); }'))))));
* 2. Tambah modal dialog untuk menampilkan detail data voucher * 3. Tambah javascript handler untuk klik icon update pada tabel gridview data voucher * 4. Tambah CGridView data voucher dengan text header ditengah dan custom view & delete handler */ ?> <h4>Search Voucher</h4> <?php // meload form pencarian data rule di ./views/common/_search.php $this->renderPartial('//common/_search', array('model' => $model, 'gridid' => 'voucher-grid', 'attribute' => 'voucher_name')); // meload modal dialog di ./views/common/_modal.php $this->renderPartial('//common/_modal'); // Javascript handler pada saat icon update ditable gridview diklik $updateHandler = ' defaultForm(); $("#Voucher_id_voucher").val(data.id_voucher); $("#Voucher_voucher_name").val(data.voucher_name); $("#Voucher_start_date").val(data.start_date); $("#Voucher_end_date").val(data.end_date); $("#Voucher_point_required").val(data.point_required); if(data.image){ $("#preview").prop("src","' . Yii::app()->baseUrl . '/uploads/"+data.image); } $("#voucher-form").attr("action","' . $this->createUrl('/master/voucher/update&id=') . '"+$("#Voucher_id_voucher").val());'; // Table gridview untuk menampilkan data voucher $this->widget('bootstrap.widgets.TbGridView', array('id' => 'voucher-grid', 'dataProvider' => $model->search(), 'type' => 'striped bordered', 'columns' => array(CAdditional::numberColumn(), 'voucher_name', array('header' => 'Start Date', 'value' => 'date(\'d F Y\',strtotime($data->start_date))', 'headerHtmlOptions' => CAdditional::$center), array('header' => 'End Date', 'value' => 'date(\'d F Y\',strtotime($data->end_date))', 'headerHtmlOptions' => CAdditional::$center), array('header' => 'Point Required', 'value' => '$data->point_required', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center), array('class' => 'bootstrap.widgets.TbButtonColumn', 'header' => 'Action', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center, 'buttons' => array('update' => CAdditional::updateHandlerColumn($updateHandler), 'view' => CAdditional::viewHandlerColumn(), 'delete' => CAdditional::deleteHandlerColumn('voucher-grid'))))));
<?php /* @var $this ViewMemberTransactionController */ $additionalHandler = "\nenableMember();\n\$('#receipt-grid').yiiGridView('update', {\n\t\tdata: {ajax:'receipt-grid',id_member:\$('#id_member').val()},\n\t\t\n\t});\n\n"; $this->renderPartial('//common/_member', array('additionalHandler' => $additionalHandler)); ?> <h6>List Of Transaction</h6> <hr/> <?php // Table gridview untuk menampilkan data member transaction $this->widget('yiiwheels.widgets.grid.WhGridView', array('id' => 'receipt-grid', 'type' => 'striped bordered', 'dataProvider' => $model->search(), 'columns' => array(CAdditional::numberColumn(), 'receipt_date', 'tenant.tenant_name', 'rule.rule_name', 'total_purchase', 'nominal_point', 'user.name')));
<?php /* @var $this UserController */ /* @var $model User */ ?> <h4>Search User</h4> <?php // meload form pencarian data rule di ./views/common/_search.php $this->renderPartial('//common/_search', array('model' => $model, 'gridid' => 'user-grid', 'attribute' => 'name')); // meload modal dialog di ./views/common/_modal.php $this->renderPartial('//common/_modal'); // Javascript handler pada saat icon update ditable gridview diklik $updateHandler = ' defaultForm(); $("#User_username").val(data.username); $("#User_name").val(data.name); $("#User_level").val(data.level); $("#user-form").attr("action","' . $this->createUrl('/master/user/update&id=') . '"+$("#User_username").val());'; // Table gridview untuk menampilkan data tenant $this->widget('bootstrap.widgets.TbGridView', array('id' => 'user-grid', 'dataProvider' => $model->search(), 'type' => 'striped bordered', 'columns' => array(CAdditional::numberColumn(), 'username', 'name', array('header' => 'Level', 'value' => '$data->level==1?\'Admin\':\'Operator\\CS\'', 'htmlOptions' => CAdditional::$center), array('header' => 'Active', 'value' => '$data->active==1?\'Active\':\'Non-Active\'', 'htmlOptions' => CAdditional::$center), array('class' => 'bootstrap.widgets.TbButtonColumn', 'header' => 'Action', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center, 'buttons' => array('update' => CAdditional::updateHandlerColumn($updateHandler), 'view' => CAdditional::viewHandlerColumn(), 'delete' => CAdditional::deleteHandlerColumn('user-grid'))))));
<?php /* @var $this RuleController * @var $model Rule * 1. Tambah form untuk pencarian data rule * 2. Tambah modal dialog untuk menampilkan detail data rule * 3. Tambah javascript handler untuk klik icon update pada tabel gridview data rule * 4. Tambah CGridView data rule dengan text header ditengah dan custom view & delete handler */ ?> <h4>Search Rule</h4> <?php // meload form pencarian data rule di ./views/common/_search.php $this->renderPartial('//common/_search', array('model' => $model, 'gridid' => 'rule-grid', 'attribute' => 'rule_name')); // meload modal dialog di ./views/common/_modal.php $this->renderPartial('//common/_modal'); // Javascript handler pada saat icon update ditable gridview diklik $updateHandler = ' defaultForm(); $.each(data,function(key,val){ $("#Rule_"+key).val(val); }); $("#rule-form").attr("action","' . $this->createUrl('/master/rule/update&id=') . '"+$("#Rule_id_rule").val());'; // Table gridview untuk menampilkan data rule $this->widget('yiiwheels.widgets.grid.WhGridView', array('id' => 'rule-grid', 'type' => 'striped bordered', 'dataProvider' => $model->search(), 'columns' => array(CAdditional::numberColumn(), 'rule_name', array('header' => 'Point', 'value' => '$data->point', 'htmlOptions' => CAdditional::$center), array('header' => 'Action', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center, 'class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update} {delete}', 'buttons' => array('update' => CAdditional::updateHandlerColumn($updateHandler), 'view' => CAdditional::viewHandlerColumn(), 'delete' => CAdditional::deleteHandlerColumn('rule-grid'))))));
$.each(data,function(key,val){ $("#Member_"+key).val(val); }); $("#Member_gender_"+data.gender).prop("checked",true); $("#Member_income_"+data.income).prop("checked",true); $("#Member_cc_"+data.cc).prop("checked",true); if (data.cc=="8"){ $("#Member_other_cc").closest("div").prev().closest("div").show(); } if (data.hobby.length > 0){ $.each(data.hobby.split(";"),function(key,val){ $("#Member_hobby_"+val).prop("checked",true); if (val=="11"){ $("#Member_other_hobby").closest("div").prev().closest("div").show(); } }); } $("#Member_id_member").prop("disabled",true); $("#member-form").attr("action","' . $this->createUrl('/master/member/update&id=') . '"+$("#Member_id_member").val());'; // Table gridview untuk menampilkan data rule $this->widget('bootstrap.widgets.TbGridView', array('id' => 'member-grid', 'type' => 'striped bordered', 'dataProvider' => $model->search(), 'columns' => array(CAdditional::numberColumn(), 'id_member', 'fullname', 'labelgender', 'place_birth', 'date_birth', 'citizenship', 'mobile1', array('header' => 'Action', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center, 'class' => 'bootstrap.widgets.TbButtonColumn', 'buttons' => array('update' => CAdditional::updateHandlerColumn($updateHandler), 'view' => CAdditional::viewHandlerColumn(), 'delete' => CAdditional::deleteHandlerColumn('member-grid')))))); ?> </div> <br/>
<?php /* @var $this TenantController /* @var $model Tenant * 1. Tambah form untuk pencarian data tenant * 2. Tambah modal dialog untuk menampilkan detail data tenant * 3. Tambah javascript handler untuk klik icon update pada tabel gridview data tenant * 4. Tambah CGridView data tenant dengan text header ditengah dan custom view & delete handler */ ?> <h4>Search Tenant</h4> <?php // meload form pencarian data rule di ./views/common/_search.php $this->renderPartial('//common/_search', array('model' => $model, 'gridid' => 'tenant-grid', 'attribute' => 'tenant_name')); // meload modal dialog di ./views/common/_modal.php $this->renderPartial('//common/_modal'); // Javascript handler pada saat icon update ditable gridview diklik $updateHandler = ' defaultForm(); $.each(data,function(key,val){ $("#Tenant_"+key).val(val); }); $("#tenant-form").attr("action","' . $this->createUrl('/master/tenant/update&id=') . '"+$("#Tenant_id_tenant").val());'; // Table gridview untuk menampilkan data tenant $this->widget('bootstrap.widgets.TbGridView', array('id' => 'tenant-grid', 'type' => 'striped bordered', 'dataProvider' => $model->search(), 'columns' => array(CAdditional::numberColumn(), 'tenant_name', 'location', 'pic', 'phone', array('header' => 'Action', 'headerHtmlOptions' => CAdditional::$center, 'htmlOptions' => CAdditional::$center, 'class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update} {delete}', 'buttons' => array('update' => CAdditional::updateHandlerColumn($updateHandler), 'view' => CAdditional::viewHandlerColumn(), 'delete' => CAdditional::deleteHandlerColumn('tenant-grid'))))));