/var/www/vhosts/nabawater/backend/controllers
Edit: /var/www/vhosts/nabawater/backend/controllers/ConfigurationController.php (10564B)
loadConfig();
return $this->render('social-media', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Tabao Credit Setting")
*/
public function actionTaoboCredit()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('tabaogo-credit', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Recaptcha Setting")
*/
public function actionRecaptcha()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('recaptcha', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Tabao Wallet Management")
*/
public function actionTaoboWallet()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('tabaogo-wallet', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Loaylity Point Redeem")
*/
public function actionLoyalityPoint()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('loyality-point', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Sms Setting")
*/
public function actionSms()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('sms', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Qr Setting")
*/
public function actionQr()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('qr', ['model' => $model]);
}
/**
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("SMTP setting")
*/
public function actionSmtp()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('smtp', ['model' => $model]);
}
/**
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Distance Time Setting")
*/
public function actionDistanceTime()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('distance-time', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Referral Point Setting")
*/
public function actionReferralPoint()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('referral-point', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("App Configuration")
*/
public function actionAppConfig()
{
$model = new Configuration();
$modelUploadForm = new ConfigurationUploadForm();
$model->loadConfig();
return $this->render('app-config', ['model' => $model, 'modelUploadForm' => $modelUploadForm]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Payumoney Configuration")
*/
public function actionPayumoneyConfig()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('payumoney-config', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Delivery Boy Setting")
*/
public function actionDeliveryBoySetting()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('delivery-boy-setting', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Delivery Charge Setting")
*/
public function actionDeliveryChargeSetting()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('delivery-charge-setting', ['model' => $model]);
}
/**
*
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("One Signal Setting")
*/
public function actionOneSignalSetting()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('one-signal-setting', ['model' => $model]);
}
/**
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Currency Setting")
*/
public function actionCurrencySetting()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('currency-setting', ['model' => $model]);
}
/**
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Strip Setting")
*/
public function actionStripe()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('stripe_config', ['model' => $model]);
}
/**
* @return string
* @throws \yii\base\InvalidParamException
*
* @Title("Strip Setting")
*/
public function actionPayment()
{
$model = new Configuration();
$model->loadConfig();
return $this->render('payment', ['model' => $model]);
}
/**
* @param bool $redirect
* @return \yii\web\Response
* @throws \yii\base\Exception
* @throws \yii\base\InvalidParamException
*/
public function actionSave($redirect = false)
{
$model = new Configuration();
$post = Yii::$app->request->post();
if ($model->load($post)) {
$modelUploadForm = new ConfigurationUploadForm();
$appLogoFile = UploadedFile::getInstance($modelUploadForm,'app_logo');
$favLogoFile = UploadedFile::getInstance($modelUploadForm, 'fav_logo');
$offerImageFile = UploadedFile::getInstance($modelUploadForm, 'offer_image');
$placeholderImageFile = UploadedFile::getInstance($modelUploadForm, 'placeholder_image');
if(isset($model->PAYMENT_TYPE)) {
$model->PAYMENT_TYPE = implode(',', $model->PAYMENT_TYPE);
}
$uploadHelper = UploadHelper::getInstance();
if(!empty($appLogoFile)) {
$uploadHelper->setPath($uploadHelper::SITE_IMAGES);
$uploadHelper->setUploadedFile($appLogoFile);
$path = $uploadHelper->getPath(true);
$appLogoFile->saveAs($path);
$realpath = $uploadHelper->getRealPath($path);
$model['APP_LOGO_PATH'] = '/'. $realpath;
}
if(!empty($favLogoFile)) {
$uploadHelper->setPath($uploadHelper::SITE_IMAGES);
$uploadHelper->setUploadedFile($favLogoFile);
$path = $uploadHelper->getPath(true);
$favLogoFile->saveAs($path);
$realpath = $uploadHelper->getRealPath($path);
$model['FAV_LOGO_PATH'] = '/'. $realpath;
}
if(!empty($offerImageFile)) {
$uploadHelper->setPath($uploadHelper::SITE_IMAGES);
$uploadHelper->setUploadedFile($offerImageFile);
$path = $uploadHelper->getPath(true);
$offerImageFile->saveAs($path);
$realpath = $uploadHelper->getRealPath($path);
$model['OFFER_IMAGE_PATH'] = '/'. $realpath;
}
if(!empty($placeholderImageFile)) {
$uploadHelper->setPath($uploadHelper::SITE_IMAGES);
$uploadHelper->setUploadedFile($placeholderImageFile);
$path = $uploadHelper->getPath(true);
$placeholderImageFile->saveAs($path);
$realpath = $uploadHelper->getRealPath($path);
$model['APP_PLACEHOLDER_PATH'] = '/'. $realpath;
}
$model->save();
//echo "
";
//print_r($post); die;
if(isset($post['Configuration']['APP_VAT'])) {
$modelVendor = Vendor::find()->where(['vendor_status' => Vendor::ACTIVE])->one();
if($modelVendor != null) {
$modelVendor->cgst = $post['Configuration']['APP_VAT'];
$modelVendor->save(false);
}
}
//
Com::successFlash("Updated Successfully");
}
$redirect = $redirect === false ? 'index' : $redirect;
$configData = $model->getConfigData();
$responseData = Com::getJsonData('POST',
Configuration::get(Configuration::DELIVERY_BOY_ACCESS_URL) . "company?company_id=".Configuration::get(Configuration::COMPANY_KEY),
$configData, 1);
if ($responseData == null) {
Yii::$app->session->setFlash('danger', Yii::t('backend', "Server is down! try again some time."));
$redirect = $redirect === false ? 'index' : $redirect;
} else {
Yii::$app->session->setFlash('success', Yii::t('backend', "Details saved successfully"));
$model->save();
//print_r($model); die;
}
return $this->redirect([$redirect]);
}
}