/var/www/vhosts/nabawater/api/modules/v1/models
Edit: /var/www/vhosts/nabawater/api/modules/v1/models/BranchApi.php (2796B)
'branch_key',
'vendor_name' => function (self $model) {
return $model->user_name;
},
'vendor_contact_name' => function (self $model) {
$modelVendorLang = BranchLang::findOne(['language_code' => Yii::$app->language, 'branch_id' => $model->branch_id]);
return $modelVendorLang !== null ? $modelVendorLang->branch_name : null;
},
'vendor_contact_email' => 'contact_email',
'vendor_contact_number' => 'contact_number',
'vendor_contact_address' => function (self $model) {
$modelVendorLang = BranchLang::findOne(['language_code' => Yii::$app->language, 'branch_id' => $model->branch_id]);
return $modelVendorLang !== null ? $modelVendorLang->branch_address_line1 : null;
},
'vendor_status' => 'branch_availability_status',
'access_token',
];
}
/**
*
* @param type $index
* @return type
*/
public static function getVendorShopStatusList()
{
return [
[
'type' => self::STATUS_OPEN,
'label' => Yii::t('backend', 'Open'),
],
[
'type' => self::STATUS_CLOSE,
'label' => Yii::t('backend', 'Close'),
'color' => 'orange'
],
[
'type' => self::STATUS_BUSY,
'label' => Yii::t('backend', 'Busy'),
'color' => 'green'
],
];
}
/**
*
* @param type $type
* @return string
*/
public static function getVendorShopStatusLable($type)
{
$list = self::getVendorShopStatusList();
foreach ($list as $value) {
if ($value['type'] === (int)$type) {
return $value['label'];
}
}
return '(not set)';
}
/**
*
* @param type $type
* @return string
*/
public static function getVendorShopStatusType($label)
{
$list = self::getVendorShopStatusList();
foreach ($list as $value) {
if (strtolower($value['label']) === (string)strtolower($label)) {
return $value['type'];
}
}
return '(not set)';
}
}