Browse Source

每日课时

lizhen_gitee 1 year ago
parent
commit
a8e22c253a

+ 4 - 3
application/admin/controller/Lessonslot.php

@@ -23,6 +23,7 @@ class Lessonslot extends Backend
         parent::_initialize();
         $this->model = new \app\admin\model\Lessonslot;
         $this->view->assign("statusList", $this->model->getStatusList());
+        $this->view->assign("noticeStatusList", $this->model->getNoticeStatusList());
     }
 
 
@@ -51,15 +52,15 @@ class Lessonslot extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             $list = $this->model
-                    ->with(['lesson','coach'])
+                    ->with(['coach','lesson'])
                     ->where($where)
                     ->order($sort, $order)
                     ->paginate($limit);
 
             foreach ($list as $row) {
                 
-                $row->getRelation('lesson')->visible(['name']);
-				$row->getRelation('coach')->visible(['nickname']);
+                $row->getRelation('coach')->visible(['nickname']);
+				$row->getRelation('lesson')->visible(['name','name_en']);
             }
 
             $result = array("total" => $list->total(), "rows" => $list->items());

+ 23 - 16
application/admin/lang/zh-cn/lessonslot.php

@@ -1,20 +1,27 @@
 <?php
 
 return [
-    'Id'             => 'id',
-    'Starttime'      => '开始时间',
-    'Hours'          => '小时数',
-    'Endtime'        => '结束时间',
-    'Num_min'        => '最少人数(取消)',
-    'Num_max'        => '最多人数',
-    'Coach_ids'      => '导师ids',
-    'Lesson_id'      => '课程id',
-    'Address'        => '地址',
-    'Status'         => '状态',
-    'Status 0'       => '报名中',
-    'Status 20'      => '已点名',
-    'Status 30'      => '已取消',
-    'Remark'         => '备注说明',
-    'Lesson.name'    => '标题',
-    'Coach.nickname' => '昵称'
+    'Id'              => 'id',
+    'Starttime'       => '开始时间',
+    'Hours'           => '小时数',
+    'Endtime'         => '结束时间',
+    'Num_min'         => '最少人数(取消)',
+    'Num_max'         => '最多人数',
+    'Coach_ids'       => '导师ids',
+    'Lesson_id'       => '课程id',
+    'Address'         => '地址',
+    'Status'          => '状态',
+    'Status 0'        => '报名中',
+    'Status 20'       => '已点名',
+    'Status 30'       => '已取消',
+    'Remark'          => '备注说明',
+    'Notice_status'   => '计划任务',
+    'Notice_status 0' => '未通知',
+    'Notice_status 1' => '已通知',
+    'Finishtime'      => '点名时间',
+    'Cancel_reason'   => '取消原因',
+    'Cancel_time'     => '取消时间',
+    'Coach.nickname'  => '昵称',
+    'Lesson.name'     => '标题',
+    'Lesson.name_en'  => '标题(en)'
 ];

+ 43 - 3
application/admin/model/Lessonslot.php

@@ -27,7 +27,10 @@ class Lessonslot extends Model
     protected $append = [
         'starttime_text',
         'endtime_text',
-        'status_text'
+        'status_text',
+        'notice_status_text',
+        'finishtime_text',
+        'cancel_time_text'
     ];
     
 
@@ -37,6 +40,11 @@ class Lessonslot extends Model
         return ['0' => __('Status 0'), '20' => __('Status 20'), '30' => __('Status 30')];
     }
 
+    public function getNoticeStatusList()
+    {
+        return ['0' => __('Notice_status 0'), '1' => __('Notice_status 1')];
+    }
+
 
     public function getStarttimeTextAttr($value, $data)
     {
@@ -59,6 +67,28 @@ class Lessonslot extends Model
         return isset($list[$value]) ? $list[$value] : '';
     }
 
+
+    public function getNoticeStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['notice_status']) ? $data['notice_status'] : '');
+        $list = $this->getNoticeStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getFinishtimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['finishtime']) ? $data['finishtime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getCancelTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['cancel_time']) ? $data['cancel_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
     protected function setStarttimeAttr($value)
     {
         return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
@@ -69,10 +99,14 @@ class Lessonslot extends Model
         return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
     }
 
+    protected function setFinishtimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
 
-    public function lesson()
+    protected function setCancelTimeAttr($value)
     {
-        return $this->belongsTo('Lesson', 'lesson_id', 'id', [], 'LEFT')->setEagerlyType(0);
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
     }
 
 
@@ -80,4 +114,10 @@ class Lessonslot extends Model
     {
         return $this->belongsTo('Coach', 'coach_ids', 'id', [], 'LEFT')->setEagerlyType(0);
     }
+
+
+    public function lesson()
+    {
+        return $this->belongsTo('Lesson', 'lesson_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
 }

+ 30 - 0
application/admin/view/lessonslot/add.html

@@ -66,6 +66,36 @@
             <input id="c-remark" class="form-control" name="row[remark]" type="text" value="">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Notice_status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="noticeStatusList" item="vo"}
+            <label for="row[notice_status]-{$key}"><input id="row[notice_status]-{$key}" name="row[notice_status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Finishtime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-finishtime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[finishtime]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Cancel_reason')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-cancel_reason" class="form-control" name="row[cancel_reason]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Cancel_time')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-cancel_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[cancel_time]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 30 - 0
application/admin/view/lessonslot/edit.html

@@ -66,6 +66,36 @@
             <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Notice_status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="noticeStatusList" item="vo"}
+            <label for="row[notice_status]-{$key}"><input id="row[notice_status]-{$key}" name="row[notice_status]" type="radio" value="{$key}" {in name="key" value="$row.notice_status"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Finishtime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-finishtime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[finishtime]" type="text" value="{:$row.finishtime?datetime($row.finishtime):''}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Cancel_reason')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-cancel_reason" class="form-control" name="row[cancel_reason]" type="text" value="{$row.cancel_reason|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Cancel_time')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-cancel_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[cancel_time]" type="text" value="{:$row.cancel_time?datetime($row.cancel_time):''}">
+        </div>
+    </div>
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 6 - 1
public/assets/js/backend/lessonslot.js

@@ -38,8 +38,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'address', title: __('Address'), operate: 'LIKE'},
                         {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"20":__('Status 20'),"30":__('Status 30')}, formatter: Table.api.formatter.status},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE'},
-                        {field: 'lesson.name', title: __('Lesson.name'), operate: 'LIKE'},
+                        {field: 'notice_status', title: __('Notice_status'), searchList: {"0":__('Notice_status 0'),"1":__('Notice_status 1')}, formatter: Table.api.formatter.status},
+                        {field: 'finishtime', title: __('Finishtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'cancel_reason', title: __('Cancel_reason'), operate: 'LIKE'},
+                        {field: 'cancel_time', title: __('Cancel_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'coach.nickname', title: __('Coach.nickname'), operate: 'LIKE'},
+                        {field: 'lesson.name', title: __('Lesson.name'), operate: 'LIKE'},
+                        {field: 'lesson.name_en', title: __('Lesson.name_en'), operate: 'LIKE'},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]