generated from liutk/owl-admin-base
Compare commits
No commits in common. "06b694f6bf74aec39f18f820e7ce2d435c6c529f" and "74bb543e7eadca9da8c643faf705c055021e86bd" have entirely different histories.
06b694f6bf
...
74bb543e7e
|
|
@ -101,14 +101,12 @@ class OvertimeController extends AdminController
|
|||
$detail = amisMake()->Property()->items([
|
||||
['label' => __('overtime_apply.store_id'), 'content' => '${store.title}'],
|
||||
['label' => __('overtime_apply.employee_id'), 'content' => '${employee.name}'],
|
||||
['label' => __('overtime_apply.created_at'), 'content' => '${created_at}'],
|
||||
['label' => __('overtime_apply.date'), 'content' => [
|
||||
amisMake()->Tag()->label('${date}'),
|
||||
amisMake()->Tag()->label('${start_at}'),
|
||||
amisMake()->Tag()->label('${end_at}'),
|
||||
], 'span' => 2],
|
||||
['label' => __('overtime_apply.date'), 'content' => '${date}'],
|
||||
['label' => __('overtime_apply.start_at'), 'content' => '${start_at}'],
|
||||
['label' => __('overtime_apply.end_at'), 'content' => '${end_at}'],
|
||||
['label' => __('overtime_apply.hours'), 'content' => '${hours}'],
|
||||
['label' => __('overtime_apply.reason'), 'content' => '${reason}', 'span' => 3],
|
||||
['label' => __('overtime_apply.created_at'), 'content' => '${created_at}'],
|
||||
['label' => __('overtime_apply.reason'), 'content' => '${reason}', 'span' => 2],
|
||||
['label' => __('workflow_log.check_status'), 'content' => amisMake()->Mapping()->name('workflow.check_status')->map(CheckStatus::options())],
|
||||
['label' => __('workflow_log.checked_at'), 'content' => '${workflow.checked_at}'],
|
||||
['label' => __('workflow_log.remarks'), 'content' => '${workflow.check_remarks}'],
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ class PromotionController extends AdminController
|
|||
]),
|
||||
]))
|
||||
->columns([
|
||||
amisMake()->TableColumn()->name('id')->label(__('employee_promotion.id')),
|
||||
amisMake()->TableColumn()->name('store.title')->label(__('employee_promotion.store_id')),
|
||||
amisMake()->TableColumn()->name('employee.name')->label(__('employee_promotion.employee_id')),
|
||||
amisMake()->TableColumn()->name('job.name')->label(__('employee_promotion.job_id')),
|
||||
|
|
@ -71,11 +70,9 @@ class PromotionController extends AdminController
|
|||
$this->rowActions([
|
||||
$this->rowShowButton()->visible(Admin::user()->can('admin.hr.promotion.view')),
|
||||
$this->rowEditTypeButton('drawer', 'xl')
|
||||
->visible(Admin::user()->can('admin.hr.promotion.update'))
|
||||
->visibleOn('${can_update}'),
|
||||
->visible(Admin::user()->can('admin.hr.promotion.update')),
|
||||
$this->rowDeleteButton()
|
||||
->visible(Admin::user()->can('admin.hr.promotion.delete'))
|
||||
->visibleOn('${can_update}'),
|
||||
->visible(Admin::user()->can('admin.hr.promotion.delete')),
|
||||
$this->cancelAction()->visibleOn('${promotion_status == '.PromotionStatus::Processing->value.'}'),
|
||||
]),
|
||||
]);
|
||||
|
|
@ -105,8 +102,7 @@ class PromotionController extends AdminController
|
|||
amisMake()->SelectControl()->name('job_id')->label(__('employee_promotion.job_id'))
|
||||
->source(admin_url('api/keywords/tree-list').'?parent_key=job')
|
||||
->labelField('name')
|
||||
->valueField('key')
|
||||
->required(),
|
||||
->valueField('key'),
|
||||
amisMake()->TextControl()->name('remarks')->label(__('employee_promotion.remarks')),
|
||||
]);
|
||||
}
|
||||
|
|
@ -123,19 +119,6 @@ class PromotionController extends AdminController
|
|||
['label' => __('employee_promotion.invitor_id'), 'content' => '${invitor.name}'],
|
||||
['label' => __('employee_promotion.promotion_status'), 'content' => amisMake()->Mapping()->name('promotion_status')->map(PromotionStatus::options())],
|
||||
['label' => __('employee_promotion.remarks'), 'content' => '${remarks}'],
|
||||
['label' => __('employee_promotion.created_at'), 'content' => '${created_at}', 'span' => 3],
|
||||
]);
|
||||
|
||||
$data = amisMake()->Property()->items([
|
||||
['label' => __('employee_promotion.age'), 'content' => '${employee_data.age}'],
|
||||
['label' => __('employee_promotion.sex'), 'content' => '${employee_data.sex}'],
|
||||
['label' => __('employee_promotion.education'), 'content' => '${employee_data.education}'],
|
||||
['label' => __('employee_promotion.first_work_time'), 'content' => '${employee_data.first_work_time}'],
|
||||
['label' => __('employee_promotion.work_years'), 'content' => '${employee_data.work_years}'],
|
||||
['label' => __('employee_promotion.work_years_in_company'), 'content' => '${employee_data.work_years_in_company}'],
|
||||
['label' => __('employee_promotion.comment_self'), 'content' => '${employee_data.comment_self}', 'span' => 3],
|
||||
['label' => __('employee_promotion.plans'), 'content' => '${employee_data.plans}', 'span' => 3],
|
||||
['label' => __('employee_promotion.reason'), 'content' => '${employee_data.reason}', 'span' => 3],
|
||||
]);
|
||||
|
||||
return $this->baseDetail()->id($detailId)->title('')->onEvent([
|
||||
|
|
@ -146,8 +129,6 @@ class PromotionController extends AdminController
|
|||
],
|
||||
])->body([
|
||||
$detail,
|
||||
amisMake()->Divider()->title('补充资料'),
|
||||
$data,
|
||||
amisMake()->Divider(),
|
||||
$this->baseWorkflowLogService($detailId)->id($serviceId),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -20,19 +20,12 @@ class AgreementService extends BaseService
|
|||
if (isset($data['images']) && $data['images']) {
|
||||
$images = [];
|
||||
foreach ($data['images'] as $value) {
|
||||
if (is_array($value)) {
|
||||
$image = data_get($value, 'value');
|
||||
$url = Str::startsWith($image, ['http://', 'https://']) ? $image : Storage::url($image);
|
||||
array_push($images, [
|
||||
'value' => $image,
|
||||
'preview' => $url,
|
||||
]);
|
||||
} else {
|
||||
array_push($images, [
|
||||
'value' => $value,
|
||||
'preview' => $value,
|
||||
]);
|
||||
}
|
||||
$image = data_get($value, 'value');
|
||||
$url = Str::startsWith($image, ['http://', 'https://']) ? $image : Storage::url($image);
|
||||
array_push($images, [
|
||||
'value' => $image,
|
||||
'preview' => $url,
|
||||
]);
|
||||
}
|
||||
$data['images'] = $images;
|
||||
}
|
||||
|
|
@ -54,34 +47,14 @@ class AgreementService extends BaseService
|
|||
return true;
|
||||
}
|
||||
|
||||
public function update($primaryKey, $data): bool
|
||||
{
|
||||
$model = $this->query()->whereKey($primaryKey)->firstOrFail();
|
||||
if (!$model->canUpdate()) {
|
||||
return $this->setError('审核中, 无法修改');
|
||||
}
|
||||
$data = $this->resloveData($data, $model);
|
||||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$model->update($data);
|
||||
$this->currentModel = $model;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||
foreach ($list as $item) {
|
||||
if (!$item->canUpdate()) {
|
||||
return $this->setError('审核中, 无法删除');
|
||||
}
|
||||
$id = explode(',', $ids);
|
||||
|
||||
foreach (Agreement::whereIn('id', $id)->get() as $item) {
|
||||
$item->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Admin\Services;
|
||||
|
||||
use Slowlyo\OwlAdmin\Services\AdminService;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @method Region getModel()
|
||||
|
|
@ -15,13 +14,6 @@ class BaseService extends AdminService
|
|||
|
||||
protected bool $modelSortAble = false;
|
||||
|
||||
protected Model $currentModel;
|
||||
|
||||
public function getCurrentModel()
|
||||
{
|
||||
return $this->currentModel;
|
||||
}
|
||||
|
||||
public function sortColumn()
|
||||
{
|
||||
return 'id';
|
||||
|
|
@ -86,8 +78,7 @@ class BaseService extends AdminService
|
|||
return false;
|
||||
}
|
||||
|
||||
$model = $this->modelName::create($data);
|
||||
$this->currentModel = $model;
|
||||
$this->modelName::create($data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -102,9 +93,8 @@ class BaseService extends AdminService
|
|||
|
||||
return false;
|
||||
}
|
||||
$model->update($data);
|
||||
$this->currentModel = $model;
|
||||
return true;
|
||||
|
||||
return $model->update($data);
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@ class EmployeePromotionService extends BaseService
|
|||
*/
|
||||
public function apply($model, $data = [])
|
||||
{
|
||||
if (!$model->canUpdate()) {
|
||||
return $this->setError('审核中, 无法修改');
|
||||
}
|
||||
$validator = Validator::make($data, [
|
||||
'age' => ['required'],
|
||||
'sex' => ['required'],
|
||||
|
|
@ -51,7 +48,7 @@ class EmployeePromotionService extends BaseService
|
|||
'plans' => ['required'],
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return $this->setError($validator->errors()->first());
|
||||
return $validator->errors()->first();
|
||||
}
|
||||
|
||||
$model->update(['employee_data' => $data, 'promotion_status' => PromotionStatus::Invitor]);
|
||||
|
|
@ -68,25 +65,35 @@ class EmployeePromotionService extends BaseService
|
|||
*/
|
||||
public function invitor($model, $data = [])
|
||||
{
|
||||
if (!$model->canUpdate()) {
|
||||
return $this->setError('审核中, 无法修改');
|
||||
}
|
||||
$validator = Validator::make($data, [
|
||||
'reason' => ['required'],
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return $this->setError($validator->errors()->first());
|
||||
return $validator->errors()->first();
|
||||
}
|
||||
|
||||
$attributes = array_merge($model->employee_data, $data);
|
||||
$model->update(['employee_data' => $attributes, 'promotion_status' => PromotionStatus::Processing]);
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$attributes = array_merge($model->employee_data, $data);
|
||||
$model->update(['employee_data' => $data, 'promotion_status' => PromotionStatus::Processing]);
|
||||
|
||||
// 发起审核申请
|
||||
$service = WorkflowService::make();
|
||||
if ($service->apply($model->workflow, $model->employee) !== true) {
|
||||
return $this->setError($service->getError());
|
||||
}
|
||||
DB::commit();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
|
||||
return $this->setError($e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function validate($data, $model = null)
|
||||
{
|
||||
// todo 验证申请人的职位是否重复
|
||||
$createRules = [
|
||||
'store_id' => ['required'],
|
||||
'employee_id' => ['required'],
|
||||
|
|
@ -101,35 +108,4 @@ class EmployeePromotionService extends BaseService
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($primaryKey, $data): bool
|
||||
{
|
||||
$model = $this->query()->whereKey($primaryKey)->firstOrFail();
|
||||
if (!$model->canUpdate()) {
|
||||
return $this->setError('审核中, 无法修改');
|
||||
}
|
||||
$data = $this->resloveData($data, $model);
|
||||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$model->update($data);
|
||||
$this->currentModel = $model;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||
foreach ($list as $item) {
|
||||
if (!$item->canUpdate()) {
|
||||
return $this->setError($item->promotion_status->text() . ', 无法删除');
|
||||
}
|
||||
$item->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,19 +65,16 @@ class HolidayApplyService extends BaseService
|
|||
return false;
|
||||
}
|
||||
|
||||
$model->update($data);
|
||||
$this->currentModel = $model;
|
||||
return true;
|
||||
return $model->update($data);
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||
$list = HolidayApply::with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||
foreach ($list as $item) {
|
||||
if (!$item->canUpdate()) {
|
||||
return $this->setError('审核中, 无法删除');
|
||||
}
|
||||
$item->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ class OfficalBusinessService extends BaseService
|
|||
|
||||
public function validate($data, $model = null)
|
||||
{
|
||||
// todo 验证申请时间是否重复
|
||||
// 验证申请时间是否重叠
|
||||
// todo
|
||||
$createRules = [
|
||||
'employee_id' => ['required'],
|
||||
'start_at' => ['required'],
|
||||
|
|
@ -50,35 +51,4 @@ class OfficalBusinessService extends BaseService
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($primaryKey, $data): bool
|
||||
{
|
||||
$model = $this->query()->whereKey($primaryKey)->firstOrFail();
|
||||
if (!$model->canUpdate()) {
|
||||
return $this->setError('审核中, 无法修改');
|
||||
}
|
||||
$data = $this->resloveData($data, $model);
|
||||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$model->update($data);
|
||||
$this->currentModel = $model;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||
foreach ($list as $item) {
|
||||
if (!$item->canUpdate()) {
|
||||
return $this->setError('审核中, 无法删除');
|
||||
}
|
||||
$item->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ class OvertimeApplyService extends BaseService
|
|||
$data['start_at'] = $start;
|
||||
$data['end_at'] = $end;
|
||||
$data['date'] = $start->format('Y-m-d');
|
||||
}
|
||||
if (isset($data['start_at']) && isset($data['end_at'])) {
|
||||
$start = $data['start_at'] instanceof \DateTime ? $data['start_at'] : Carbon::parse($data['start_at']);
|
||||
$end = $data['end_at'] instanceof \DateTime ? $data['end_at'] : Carbon::parse($data['end_at']);
|
||||
$data['hours'] = $start->diffInHours($end);
|
||||
}
|
||||
|
||||
|
|
@ -41,10 +37,10 @@ class OvertimeApplyService extends BaseService
|
|||
|
||||
public function validate($data, $model = null)
|
||||
{
|
||||
// todo 验证申请时间是否重复
|
||||
// 验证申请时间是否重叠
|
||||
// todo
|
||||
$createRules = [
|
||||
'employee_id' => ['required'],
|
||||
'date' => ['required'],
|
||||
'start_at' => ['required'],
|
||||
'end_at' => ['required'],
|
||||
];
|
||||
|
|
@ -56,33 +52,4 @@ class OvertimeApplyService extends BaseService
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($primaryKey, $data): bool
|
||||
{
|
||||
$model = $this->query()->whereKey($primaryKey)->firstOrFail();
|
||||
if (!$model->canUpdate()) {
|
||||
return $this->setError('审核中, 无法修改');
|
||||
}
|
||||
$data = $this->resloveData($data, $model);
|
||||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $model->update($data);
|
||||
}
|
||||
|
||||
public function delete(string $ids): mixed
|
||||
{
|
||||
$list = $this->query()->with(['workflow'])->whereIn('id', explode(',', $ids))->get();
|
||||
foreach ($list as $item) {
|
||||
if (!$item->canUpdate()) {
|
||||
return $this->setError('审核中, 无法删除');
|
||||
}
|
||||
$item->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ class WorkFlowService extends BaseService
|
|||
*/
|
||||
public function apply(WorkflowCheck $check, Employee $user)
|
||||
{
|
||||
if ($check->check_status === CheckStatus::Success) {
|
||||
if ($check->check_status === CheckStatus::Success->value) {
|
||||
admin_abort('已经审核通过');
|
||||
}
|
||||
if ($check->check_status === CheckStatus::Processing) {
|
||||
if ($check->check_status === CheckStatus::Processing->value) {
|
||||
admin_abort('正在审核中');
|
||||
}
|
||||
|
||||
|
|
@ -113,8 +113,6 @@ class WorkFlowService extends BaseService
|
|||
'checked_at' => data_get($options, 'checked_at', now()),
|
||||
]);
|
||||
|
||||
$check->subject->checkFail();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +128,6 @@ class WorkFlowService extends BaseService
|
|||
'check_status' => CheckStatus::Cancel,
|
||||
]);
|
||||
|
||||
$check->subject->checkCancel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ enum PromotionStatus: int
|
|||
*/
|
||||
case Employee = 1;
|
||||
/**
|
||||
* 待推荐, 等待推荐人填写理由
|
||||
* 待补充, 等待推荐人填写理由
|
||||
*/
|
||||
case Invitor = 2;
|
||||
/**
|
||||
|
|
@ -32,7 +32,7 @@ enum PromotionStatus: int
|
|||
{
|
||||
return [
|
||||
self::Employee->value => '待提交',
|
||||
self::Invitor->value => '待推荐',
|
||||
self::Invitor->value => '待补充',
|
||||
self::Processing->value => '审核中',
|
||||
self::Success->value => '审核通过',
|
||||
self::Fail->value => '审核不通过',
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Agreement;
|
||||
use App\Http\Resources\AgreementResource;
|
||||
use App\Admin\Services\{AgreementService, WorkFlowService};
|
||||
use App\Exceptions\RuntimeException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* 合同管理
|
||||
*/
|
||||
class AgreementController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$list = Agreement::with(['workflow'])
|
||||
->where('employee_id', $user->id)
|
||||
->filter($request->all())
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($request->input('per_page'));
|
||||
|
||||
return AgreementResource::collection($list);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$info = Agreement::with(['employee', 'workflow'])->findOrFail($id);
|
||||
|
||||
return AgreementResource::make($info);
|
||||
}
|
||||
|
||||
public function store(Request $request, AgreementService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$data = $request->all();
|
||||
$data['employee_id'] = $user->id;
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->store($data)) {
|
||||
throw new RuntimeException($result);
|
||||
}
|
||||
$model = $service->getCurrentModel();
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id, Request $request, AgreementService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = Agreement::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->update($id, $request->all())) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id, AgreementService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = Agreement::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->delete($id)) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Http\Controllers\Api\Hr;
|
||||
|
||||
use App\Http\Controllers\Api\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\{Request, Response};
|
||||
use App\Models\HolidayApply;
|
||||
use App\Http\Resources\HolidayApplyResource;
|
||||
use App\Admin\Services\{HolidayApplyService, WorkFlowService};
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Hr;
|
||||
|
||||
use App\Http\Controllers\Api\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\OfficalBusiness;
|
||||
use App\Http\Resources\OfficalBusinessResource;
|
||||
use App\Admin\Services\{OfficalBusinessService, WorkFlowService};
|
||||
use App\Exceptions\RuntimeException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* 出差报备
|
||||
*/
|
||||
class OfficalBusinessController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$list = OfficalBusiness::with(['workflow'])
|
||||
->where('employee_id', $user->id)
|
||||
->filter($request->all())
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($request->input('per_page'));
|
||||
|
||||
return OfficalBusinessResource::collection($list);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$info = OfficalBusiness::with(['employee', 'store', 'workflow'])->findOrFail($id);
|
||||
|
||||
return OfficalBusinessResource::make($info);
|
||||
}
|
||||
|
||||
public function store(Request $request, OfficalBusinessService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$data = $request->all();
|
||||
$data['employee_id'] = $user->id;
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->store($data)) {
|
||||
throw new RuntimeException($result);
|
||||
}
|
||||
$model = $service->getCurrentModel();
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id, Request $request, OfficalBusinessService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = OfficalBusiness::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->update($id, $request->all())) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id, OfficalBusinessService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = OfficalBusiness::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->delete($id)) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Hr;
|
||||
|
||||
use App\Http\Controllers\Api\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\OvertimeApply;
|
||||
use App\Http\Resources\OvertimeApplyResource;
|
||||
use App\Admin\Services\{OvertimeApplyService, WorkFlowService};
|
||||
use App\Exceptions\RuntimeException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* 加班申请
|
||||
*/
|
||||
class OvertimeController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$list = OvertimeApply::with(['workflow'])
|
||||
->where('employee_id', $user->id)
|
||||
->filter($request->all())
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($request->input('per_page'));
|
||||
|
||||
return OvertimeApplyResource::collection($list);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$info = OvertimeApply::with(['employee', 'store', 'workflow'])->findOrFail($id);
|
||||
|
||||
return OvertimeApplyResource::make($info);
|
||||
}
|
||||
|
||||
public function store(Request $request, OvertimeApplyService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$data = $request->all();
|
||||
$data['employee_id'] = $user->id;
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->store($data)) {
|
||||
throw new RuntimeException($result);
|
||||
}
|
||||
$model = $service->getCurrentModel();
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id, Request $request, OvertimeApplyService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = OvertimeApply::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->update($id, $request->all())) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id, OvertimeApplyService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = OvertimeApply::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->delete($id)) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Hr;
|
||||
|
||||
use App\Http\Controllers\Api\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\EmployeePromotion;
|
||||
use App\Http\Resources\EmployeePromotionResource;
|
||||
use App\Admin\Services\{EmployeePromotionService, WorkFlowService};
|
||||
use App\Exceptions\RuntimeException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Enums\PromotionStatus;
|
||||
|
||||
/**
|
||||
* 升职申请
|
||||
*/
|
||||
class PromotionController extends Controller
|
||||
{
|
||||
/**
|
||||
* 申请列表
|
||||
*/
|
||||
public function applyList(Request $request)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$list = EmployeePromotion::with(['workflow', 'invitor', 'job'])
|
||||
->where('employee_id', $user->id)
|
||||
->filter($request->all())
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($request->input('per_page'));
|
||||
|
||||
return EmployeePromotionResource::collection($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐列表
|
||||
*/
|
||||
public function inviteList(Request $request)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$list = EmployeePromotion::with(['workflow', 'employee', 'job'])
|
||||
->where('invitor_id', $user->id)
|
||||
->filter($request->all())
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($request->input('per_page'));
|
||||
|
||||
return EmployeePromotionResource::collection($list);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$info = EmployeePromotion::with(['workflow', 'employee', 'invitor', 'job'])->findOrFail($id);
|
||||
|
||||
return EmployeePromotionResource::make($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请人完善资料
|
||||
*/
|
||||
public function applyUpdate($id, Request $request, EmployeePromotionService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$info = EmployeePromotion::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
if (!$service->apply($info, $request->all())) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐人填写
|
||||
*/
|
||||
public function inviteUpdate($id, Request $request, EmployeePromotionService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = EmployeePromotion::with(['workflow', 'employee'])->where('invitor_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->invitor($model, $request->all())) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $model->employee)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id, EmployeePromotionService $service)
|
||||
{
|
||||
$user = $this->guard()->user();
|
||||
$model = EmployeePromotion::where('employee_id', $user->id)->findOrFail($id);
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->delete($id)) {
|
||||
throw new RuntimeException($service->getError());
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return response()->noContent();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,10 +35,12 @@ class SignRepairController extends Controller
|
|||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->store($data)) {
|
||||
$data = $service->resloveData($data);
|
||||
$result = $service->validate($data);
|
||||
if ($result !== true) {
|
||||
throw new RuntimeException($result);
|
||||
}
|
||||
$model = $service->getCurrentModel();
|
||||
$model = EmployeeSignRepair::create($data);
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
|
|
@ -69,9 +71,12 @@ class SignRepairController extends Controller
|
|||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$service->update($id, $request->all())) {
|
||||
throw new RuntimeException($service->getError());
|
||||
$data = $service->resloveData($request->all(), $model);
|
||||
$result = $service->validate($data, $model);
|
||||
if ($result !== true) {
|
||||
throw new RuntimeException($result);
|
||||
}
|
||||
$model->update($data);
|
||||
$workflow = WorkFlowService::make();
|
||||
if (!$workflow->apply($model->workflow, $user)) {
|
||||
throw new RuntimeException($workflow->getError());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace App\Http\Controllers\Api;
|
|||
|
||||
use Illuminate\Http\{Request, Response};
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use App\Http\Resources\{ReimbursementResource, WorkflowLogResource, EmployeeSignRepairResource, HolidayApplyResource, OvertimeApplyResource, AgreementResource, EmployeePromotionResource};
|
||||
use App\Http\Resources\{ReimbursementResource, WorkflowLogResource, EmployeeSignRepairResource, HolidayApplyResource};
|
||||
use App\Enums\CheckStatus;
|
||||
use App\Models\{WorkflowLog, WorkflowCheck};
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
@ -126,15 +126,7 @@ class WorkflowController extends Controller
|
|||
'reimbursements' => ReimbursementResource::class,
|
||||
'employee_sign_repairs' => EmployeeSignRepairResource::class,
|
||||
'holiday_applies' => HolidayApplyResource::class,
|
||||
'overtime_applies' => OvertimeApplyResource::class,
|
||||
'agreements' => AgreementResource::class,
|
||||
'offical_business' => OfficalBusinessResource::class,
|
||||
'employee_promotions' => EmployeePromotionResource::class,
|
||||
];
|
||||
$resource = data_get($map, $key);
|
||||
if (!$resource) {
|
||||
throw new RuntimeException('未知的 subject_type resource: ' . $key);
|
||||
}
|
||||
return $resource;
|
||||
return data_get($map, $key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AgreementResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'images' => $this->images,
|
||||
|
||||
'employee_id' => $this->employee_id,
|
||||
'employee' => EmployeeResource::make($this->whenLoaded('employee')),
|
||||
|
||||
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
|
||||
|
||||
'created_at' => $this->created_at->timestamp,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class EmployeePromotionResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
'employee_id' => $this->employee_id,
|
||||
'employee' => EmployeeResource::make($this->whenLoaded('employee')),
|
||||
'store_id' => $this->store_id,
|
||||
'store' => StoreResource::make($this->whenLoaded('store')),
|
||||
|
||||
'invitor_id' => $this->invitor_id,
|
||||
'invitor' => EmployeeResource::make($this->whenLoaded('invitor')),
|
||||
'job_id' => $this->job_id,
|
||||
'job' => KeywordResource::make($this->whenLoaded('job')),
|
||||
|
||||
'promotion_status' => $this->promotion_status,
|
||||
'promotion_status_text' => $this->promotion_status->text(),
|
||||
'employee_data' => $this->employee_data,
|
||||
'created_at' => $this->created_at->timestamp,
|
||||
|
||||
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OfficalBusinessResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
'employee_id' => $this->employee_id,
|
||||
'employee' => EmployeeResource::make($this->whenLoaded('employee')),
|
||||
'store_id' => $this->store_id,
|
||||
'store' => StoreResource::make($this->whenLoaded('store')),
|
||||
|
||||
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
|
||||
|
||||
'start_at' => $this->start_at->timestamp,
|
||||
'end_at' => $this->end_at->timestamp,
|
||||
'address' => $this->address,
|
||||
'reason' => $this->reason,
|
||||
|
||||
'created_at' => $this->created_at->timestamp,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OvertimeApplyResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
||||
'employee_id' => $this->employee_id,
|
||||
'employee' => EmployeeResource::make($this->whenLoaded('employee')),
|
||||
'store_id' => $this->store_id,
|
||||
'store' => StoreResource::make($this->whenLoaded('store')),
|
||||
|
||||
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
|
||||
|
||||
'date' => $this->date->timestamp,
|
||||
'start_at' => $this->start_at->timestamp,
|
||||
'end_at' => $this->end_at->timestamp,
|
||||
'hours' => $this->hours,
|
||||
|
||||
'reason' => $this->reason,
|
||||
'created_at' => $this->created_at->timestamp,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ use App\Traits\HasCheckable;
|
|||
use App\Traits\HasDateTimeFormatter;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
/**
|
||||
* 员工升职申请
|
||||
|
|
@ -23,38 +22,11 @@ class EmployeePromotion extends Model
|
|||
'employee_data' => 'json',
|
||||
];
|
||||
|
||||
protected $appends = ['can_update'];
|
||||
|
||||
public function modelFilter()
|
||||
{
|
||||
return \App\Admin\Filters\EmployeePromotionFilter::class;
|
||||
}
|
||||
|
||||
public function checkSuccess()
|
||||
{
|
||||
$this->update(['promotion_status' => PromotionStatus::Success]);
|
||||
}
|
||||
|
||||
public function checkFail()
|
||||
{
|
||||
$this->update(['promotion_status' => PromotionStatus::Fail]);
|
||||
}
|
||||
|
||||
public function checkCancel()
|
||||
{
|
||||
$this->update(['promotion_status' => PromotionStatus::Employee]);
|
||||
}
|
||||
|
||||
public function canUpdate(): bool
|
||||
{
|
||||
return in_array($this->promotion_status, [PromotionStatus::Employee, PromotionStatus::Invitor, PromotionStatus::Fail]);
|
||||
}
|
||||
|
||||
public function getCanUpdateAttribute()
|
||||
{
|
||||
return $this->canUpdate();
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
return $this->belongsTo(Store::class, 'store_id');
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class OfficalBusiness extends Model
|
|||
protected $fillable = ['store_id', 'employee_id', 'start_at', 'end_at', 'address', 'reason'];
|
||||
|
||||
protected $casts = [
|
||||
'start_at' => 'date:Y-m-d H:i',
|
||||
'end_at' => 'date:Y-m-d H:i',
|
||||
'start_at' => 'date:Y-m-d',
|
||||
'end_at' => 'date:Y-m-d',
|
||||
];
|
||||
|
||||
public function modelFilter()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Enums\{CheckStatus};
|
||||
use App\Traits\{HasCheckable, HasDateTimeFormatter};
|
||||
use App\Traits\HasCheckable;
|
||||
use App\Traits\HasDateTimeFormatter;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
@ -18,8 +19,8 @@ class OvertimeApply extends Model
|
|||
|
||||
protected $casts = [
|
||||
'date' => 'date:Y-m-d',
|
||||
'start_at' => 'datetime:H:i',
|
||||
'end_at' => 'datetime:H:i',
|
||||
'start_at' => 'datetime',
|
||||
'end_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function modelFilter()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Traits;
|
|||
|
||||
use App\Models\WorkflowCheck;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Enums\CheckStatus;
|
||||
|
||||
trait HasCheckable
|
||||
{
|
||||
|
|
@ -39,21 +38,6 @@ trait HasCheckable
|
|||
|
||||
}
|
||||
|
||||
public function checkFail()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function checkCancel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function canUpdate(): bool
|
||||
{
|
||||
return in_array($this->workflow?->check_status, [CheckStatus::None, CheckStatus::Fail, CheckStatus::Cancel]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联审核流水
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -69,26 +69,9 @@ Route::group([
|
|||
// 请假管理
|
||||
Route::apiResource('hr/holidays', \App\Http\Controllers\Api\Hr\HolidayController::class);
|
||||
|
||||
// 加班申请
|
||||
Route::apiResource('hr/overtimes', \App\Http\Controllers\Api\Hr\OvertimeController::class);
|
||||
|
||||
// 出差报备
|
||||
Route::apiResource('hr/offical-bussiness', \App\Http\Controllers\Api\Hr\OfficalBusinessController::class);
|
||||
|
||||
// 升职申请
|
||||
Route::get('hr/promotion/apply', [\App\Http\Controllers\Api\Hr\PromotionController::class, 'applyList']);
|
||||
Route::get('hr/promotion/invite', [\App\Http\Controllers\Api\Hr\PromotionController::class, 'inviteList']);
|
||||
Route::get('hr/promotion/{id}', [\App\Http\Controllers\Api\Hr\PromotionController::class, 'show']);
|
||||
Route::post('hr/promotion/{id}/apply', [\App\Http\Controllers\Api\Hr\PromotionController::class, 'applyUpdate']);
|
||||
Route::post('hr/promotion/{id}/invite', [\App\Http\Controllers\Api\Hr\PromotionController::class, 'inviteUpdate']);
|
||||
Route::delete('hr/promotion/{id}', [\App\Http\Controllers\Api\Hr\PromotionController::class, 'destroy']);
|
||||
|
||||
// 报销管理
|
||||
Route::apiResource('reimbursements', \App\Http\Controllers\Api\ReimbursementController::class);
|
||||
|
||||
// 合同管理
|
||||
Route::apiResource('agreements', \App\Http\Controllers\Api\AgreementController::class);
|
||||
|
||||
// 审核流程
|
||||
Route::get('workflow', [\App\Http\Controllers\Api\WorkflowController::class, 'index']);
|
||||
Route::get('workflow/{id}', [\App\Http\Controllers\Api\WorkflowController::class, 'show']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue