admin employees.is_sign

main
panliang 2024-05-11 14:47:06 +08:00
parent 6cc0ccec5f
commit 6705f1b516
5 changed files with 32 additions and 2 deletions

View File

@ -41,6 +41,7 @@ class EmployeeController extends AdminController
amisMake()->TableColumn()->name('employee_status_text')->label(__('employee.employee_status'))->set('type', 'tag')->set('color', '${employee_status_color}'),
amisMake()->TableColumn()->name('store.title')->label(__('employee.store_id')),
amisMake()->TableColumn()->name('remarks')->label(__('employee.remarks')),
amis()->TableColumn()->name('is_sign')->label(__('employee.is_sign'))->type('switch'),
$this->rowActions([
$this->rowShowButton()->visible(Admin::user()->can('admin.hr.employees.view')),
$this->rowEditTypeButton('drawer', 'lg')->visible(Admin::user()->can('admin.hr.employees.update')),

View File

@ -41,7 +41,7 @@ class EmployeeSignService extends BaseService
// 休息的员工
$restEmployeeIds = EmployeeRest::whereBetWeen('date', [$start, $end])->pluck('employee_id');
// 需要打卡的员工
$employees = Employee::where('store_id', '>', 0)->whereNotIn('id', $restEmployeeIds)->get();
$employees = Employee::where('store_id', '>', 0)->where('is_sign', 1)->whereNotIn('id', $restEmployeeIds)->get();
foreach ($employees as $employee) {
$logs = $list->where('employee_id', $employee->id);
// 状态: 两个打卡=正常, 一次打卡 = 缺卡, 两次未打=旷工

View File

@ -24,7 +24,7 @@ class Employee extends Model implements AuthenticatableContract
const JOB_KEY = 'job';
protected $fillable = ['store_id', 'name', 'avatar', 'phone', 'prize_images', 'skill_images', 'employee_status', 'admin_user_id', 'leave_at', 'join_at', 'remarks'];
protected $fillable = ['store_id', 'name', 'avatar', 'phone', 'prize_images', 'skill_images', 'employee_status', 'admin_user_id', 'leave_at', 'join_at', 'remarks', 'is_sign'];
protected $casts = [
'employee_status' => EmployeeStatus::class,

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('employees', function (Blueprint $table) {
$table->unsignedTinyInteger('is_sign')->default(1)->comment('0: 不打卡, 1: 需要打卡');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('employees', function (Blueprint $table) {
$table->dropColumn('is_sign');
});
}
};

View File

@ -20,4 +20,5 @@ return [
'leave_confirm' => '是否确定?',
'remarks' => '备注',
'store_id' => '门店',
'is_sign' => '打卡',
];