*/
public function getInfo($data) {
$phone = $data->phone;
- $admin_id = !empty(Admin::findOne(['mobile' => $phone])) ? Admin::findOne(['mobile' => $phone])->id : null;
$ref_code = !empty($data->ref_code) ? $data->ref_code : '';
$cond = !empty($phone) ? ['phone' => $phone] : ['ref_code' => $ref_code];
$mess['total_price_rejected'] = (int)$sales_rejected_sum ?? 0; // Выручка отмененных заявок
$mess["referral_count_get_bonus_already"] = (int)$referral_count_get_bonus_already;
$mess["referral_count_all"] = (int)$referral_count_all;
- $mess["plan_id"] = !empty($timetable = Timetable::findOne(['admin_id' => $admin_id, 'date' => date('Y-m-d'), 'tabel' => 0])) ? $timetable->id : 0;
$mess["events"] = $this->listEvents($phone);
public function getShifts() {
$shifts = Shift::find()->where(['not in', 'id', [3, 4, 6, 7]])->all();
- return ArrayHelper::map($shifts, 'id', 'name');
+ $result = [];
+ foreach ($shifts as $shift) {
+ if (!empty($shift->name ?? null)) {
+ $result [] = ['id' => $shift->id, 'name' => $shift->name];
+ }
+ }
+ return $result;
}
/**
'phone' => 'mobile',
'group' => 'adminGroup',
'export' => 'exportImportTable',
- 'parent_admin_id'
+ 'parent_admin_id',
+ 'plan_id'
];
/*if($this->parent_admin_id) {
return $this->hasOne(self::class, ['id' => 'parent_admin_id']);
}
+ public function getPlanId()
+ {
+ return $this->hasOne( Timetable::class, ['admin_id' => 'id'])
+ ->andWhere(['date' => date('Y-m-d')])
+ ->andWhere(['tabel' => 0]);
+ }
+
+
// Получить последнюю в списке запись о з.п.
public function getSalary() {
return $this->hasOne(EmployeePayment::class, ['admin_id' => 'id'])->orderBy(['date' => SORT_DESC]);