Your IP : 3.16.136.129


Current Path : /var/www/axolotl/data/www/msk.axolotls.ru/bitrix/modules/timeman/lib/controller/
Upload File :
Current File : /var/www/axolotl/data/www/msk.axolotls.ru/bitrix/modules/timeman/lib/controller/shift.php

<?php
namespace Bitrix\Timeman\Controller;

use Bitrix\Timeman\UseCase\Schedule\Shift as ShiftHandler;
use Bitrix\Main\Engine\Controller;
use Bitrix\Timeman\Form\Schedule\ShiftForm;

class Shift extends Controller
{
	public function addAction()
	{
		$shiftForm = new ShiftForm();

		if ($shiftForm->load($this->getRequest()) && $shiftForm->validate())
		{
			$result = (new ShiftHandler\Create\Handler())->handle($shiftForm);

			if ($result->isSuccess())
			{
				return ['shiftId' => $result->getShift()->getId()];
			}
		}
		$this->addError($shiftForm->getFirstError());
	}
}