コード例 #1
0
 /**
  * Fungsi untuk menghapus data metode pembayaran
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function destroy($id)
 {
     $payment_method = PaymentMethod::find($id);
     if ($payment_method) {
         if ($payment_method->delete()) {
             return ['status' => 'success', 'message' => 'Metode pembayaran berhasil dihapus'];
         } else {
             return ['status' => 'failed', 'message' => 'Metode pembayaran gagal dihapus.'];
         }
     } else {
         return ['status' => 'failed', 'message' => 'Metode pembayaran tidak ditemukan.'];
     }
 }
コード例 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PaymentMethod::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_by' => $this->created_by, 'created_at' => $this->created_at, 'updated_by' => $this->updated_by, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'type', $this->type]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: _form.php プロジェクト: asimzeeshan/AliExpressOTS
    ?>

    <?php 
    echo $form->field($model, 'delivery_date')->widget(\yii\jui\DatePicker::classname(), ['options' => ['class' => 'form-control'], 'dateFormat' => 'yyyy-MM-dd']);
    ?>

    <?php 
}
?>

    <?php 
echo $form->field($model, 'arrived_in')->hiddenInput()->label(false);
?>

    <?php 
$allPaymentMethods = ArrayHelper::map(\app\models\PaymentMethod::find()->orderBy('id')->all(), 'id', 'name');
?>
    <?php 
echo $form->field($model, 'paid_with')->dropDownList($allPaymentMethods, ['prompt' => ' -- Select Payment Method --'])->label('Payment Method');
?>

    <?php 
if (!$model->isNewRecord) {
    ?>

    <?php 
    echo $form->field($model, 'is_disputed')->checkBox();
    ?>

    <?php 
    echo $form->field($model, 'refund_status')->dropDownList(['Not Applicable' => 'Not Applicable', 'In Progress' => 'In Progress', 'Fully Refunded' => 'Fully Refunded', 'Partially Refunded' => 'Partially Refunded', 'Escalated' => 'Escalated', 'Lost' => 'Lost']);