| @@ -4,6 +4,7 @@ namespace App\Email\Members; | |||||
| use App\Kintone\Models\SeasonTicketContractEntry; | use App\Kintone\Models\SeasonTicketContractEntry; | ||||
| use App\Kintone\Models\SeasonTicketContractSelection; | use App\Kintone\Models\SeasonTicketContractSelection; | ||||
| use App\Logic\SeasonTicketContractEntryManager; | |||||
| use App\Logic\SeasonTicketContractSelectionManager; | use App\Logic\SeasonTicketContractSelectionManager; | ||||
| class SelectionNotice extends Members | class SelectionNotice extends Members | ||||
| @@ -29,6 +30,7 @@ class SelectionNotice extends Members | |||||
| public function getMemberParams(): array | public function getMemberParams(): array | ||||
| { | { | ||||
| $manager = new SeasonTicketContractSelectionManager($this->selection); | $manager = new SeasonTicketContractSelectionManager($this->selection); | ||||
| $entryManager = new SeasonTicketContractEntryManager($this->entry); | |||||
| return [ | return [ | ||||
| 'customer_name' => $this->entry->customerName, | 'customer_name' => $this->entry->customerName, | ||||
| @@ -38,7 +40,13 @@ class SelectionNotice extends Members | |||||
| 'selection', 'entry', | 'selection', 'entry', | ||||
| $this->selection->getRecordId(), | $this->selection->getRecordId(), | ||||
| $this->entry->getRecordId(), | $this->entry->getRecordId(), | ||||
| $manager->getHash($this->entry->getRecordId()) | |||||
| $manager->getHash($this->entry->getRecordId()), | |||||
| ]), | |||||
| 'cancel_url' => $this->getAppUrl([ | |||||
| 'season-ticket-contract', | |||||
| 'entry', 'cancel', | |||||
| $this->entry->getRecordId(), | |||||
| $entryManager->getHash() | |||||
| ]), | ]), | ||||
| ]; | ]; | ||||
| } | } | ||||
| @@ -7,7 +7,7 @@ use App\Logic\SeasonTicketContractEntryManager; | |||||
| use Illuminate\Http\JsonResponse; | use Illuminate\Http\JsonResponse; | ||||
| use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||
| class EntryInfoController extends WebController | |||||
| class CancelController extends WebController | |||||
| { | { | ||||
| public function name(): string | public function name(): string | ||||
| { | { | ||||
| @@ -34,8 +34,9 @@ class EntryInfoController extends WebController | |||||
| return $this->failedResponse(); | return $this->failedResponse(); | ||||
| } | } | ||||
| $entry = $manager->getEntry(); | |||||
| $manager->cancel() | |||||
| ->save(); | |||||
| return $this->successResponse($entry->toArray()); | |||||
| return $this->successResponse(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -7,7 +7,7 @@ use App\Logic\SeasonTicketContractEntryManager; | |||||
| use Illuminate\Http\JsonResponse; | use Illuminate\Http\JsonResponse; | ||||
| use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||
| class CancelController extends WebController | |||||
| class EntryInfoController extends WebController | |||||
| { | { | ||||
| public function name(): string | public function name(): string | ||||
| @@ -57,6 +57,7 @@ class SeasonTicketContractEntry extends KintoneModel | |||||
| protected const FIELDS = [ | protected const FIELDS = [ | ||||
| ...parent::FIELDS, | ...parent::FIELDS, | ||||
| self::FIELD_PARKING_NAME => FieldType::SINGLE_LINE_TEXT, | self::FIELD_PARKING_NAME => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_STATUS => FieldType::DROP_DOWN, | |||||
| self::FIELD_CUSTOMER_NAME => FieldType::SINGLE_LINE_TEXT, | self::FIELD_CUSTOMER_NAME => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_CUSTOMER_NAME_KANA => FieldType::SINGLE_LINE_TEXT, | self::FIELD_CUSTOMER_NAME_KANA => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_PHONE_NO => FieldType::SINGLE_LINE_TEXT, | self::FIELD_PHONE_NO => FieldType::SINGLE_LINE_TEXT, | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Logic; | namespace App\Logic; | ||||
| use App\Exceptions\GeneralErrorMessageException; | |||||
| use App\Kintone\Models\DropDown\SeasonTicketContractEntry\Status; | use App\Kintone\Models\DropDown\SeasonTicketContractEntry\Status; | ||||
| use App\Kintone\Models\SeasonTicketContractEntry; | use App\Kintone\Models\SeasonTicketContractEntry; | ||||
| @@ -9,10 +10,13 @@ class SeasonTicketContractEntryManager | |||||
| { | { | ||||
| private SeasonTicketContractEntry $entry; | private SeasonTicketContractEntry $entry; | ||||
| public function __construct(int|SeasonTicketContractEntry $recordNo = null) | |||||
| public function __construct(int|SeasonTicketContractEntry $recordNo = null, bool $includeCancel = false) | |||||
| { | { | ||||
| if (is_int($recordNo)) { | if (is_int($recordNo)) { | ||||
| $this->entry = SeasonTicketContractEntry::find($recordNo); | $this->entry = SeasonTicketContractEntry::find($recordNo); | ||||
| if (!$includeCancel && $this->entry->status === Status::CANCEL) { | |||||
| throw new GeneralErrorMessageException("すでにキャンセル済みです"); | |||||
| } | |||||
| return; | return; | ||||
| } else if ($recordNo instanceof SeasonTicketContractEntry) { | } else if ($recordNo instanceof SeasonTicketContractEntry) { | ||||
| $this->entry = $recordNo; | $this->entry = $recordNo; | ||||