| @@ -3,7 +3,6 @@ | |||||
| namespace App\Email\Members; | namespace App\Email\Members; | ||||
| use App\Kintone\Models\Customer; | use App\Kintone\Models\Customer; | ||||
| use App\Kintone\Models\SeasonTicketContract; | |||||
| use App\Kintone\Models\UserInfoUpdateApplication; | use App\Kintone\Models\UserInfoUpdateApplication; | ||||
| class UserInfoUpdateOrderNotice extends Members | class UserInfoUpdateOrderNotice extends Members | ||||
| @@ -11,7 +10,6 @@ class UserInfoUpdateOrderNotice extends Members | |||||
| public function __construct( | public function __construct( | ||||
| protected Customer $customer, | protected Customer $customer, | ||||
| private SeasonTicketContract $seasonTicketContract, | |||||
| private UserInfoUpdateApplication $app | private UserInfoUpdateApplication $app | ||||
| ) { | ) { | ||||
| parent::__construct($customer); | parent::__construct($customer); | ||||
| @@ -2,9 +2,12 @@ | |||||
| namespace App\Http\Controllers\Web\Customer; | namespace App\Http\Controllers\Web\Customer; | ||||
| use App\Email\Members\ParkingCertificateOrderNotice; | |||||
| use App\Email\Members\UserInfoUpdateOrderNotice; | |||||
| use App\Http\Controllers\Web\WebController; | use App\Http\Controllers\Web\WebController; | ||||
| use App\Kintone\Models\Customer; | |||||
| use App\Kintone\Models\UserInfoUpdateApplication; | |||||
| use App\Logic\EmailManager; | use App\Logic\EmailManager; | ||||
| use App\Logic\GeneralApplicationManager; | |||||
| use Illuminate\Http\JsonResponse; | use Illuminate\Http\JsonResponse; | ||||
| use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||
| use Illuminate\Support\Facades\Auth; | use Illuminate\Support\Facades\Auth; | ||||
| @@ -31,12 +34,35 @@ class UpdateUserInfoOrderController extends WebController | |||||
| protected function run(Request $request): JsonResponse | protected function run(Request $request): JsonResponse | ||||
| { | { | ||||
| $user = Auth::user(); | |||||
| $param = $this->param; | |||||
| $mailer = (new ParkingCertificateOrderNotice()) | |||||
| ->setUser($user); | |||||
| (new EmailManager($mailer))->confirm(); | |||||
| $customer = Customer::getSelf(); | |||||
| $application = new UserInfoUpdateApplication(); | |||||
| $manager = new GeneralApplicationManager($application); | |||||
| $manager | |||||
| ->setCustomer($customer) | |||||
| ->makeApplication(); | |||||
| $application->nameBefore = $customer->customerName; | |||||
| $application->nameAfter = $param->name; | |||||
| $application->nameKanaBefore = $customer->customerNameKana; | |||||
| $application->nameKanaAfter = $param->nameKana; | |||||
| $application->zipCodeBefore = $customer->zipCode; | |||||
| $application->zipCodeAfter = $param->zipCode; | |||||
| $application->addressBefore = $customer->address; | |||||
| $application->addressAfter = $param->address; | |||||
| $application->phoneNoBefore = $customer->phoneNumber; | |||||
| $application->phoneNoAfter = $param->phoneNo; | |||||
| $application->memo = $param->memo; | |||||
| // メール送信 | |||||
| $email = new UserInfoUpdateOrderNotice($customer, $application); | |||||
| $email->setUser(Auth::user()); | |||||
| $emailMmanager = new EmailManager($email); | |||||
| $emailMmanager->confirm(); | |||||
| $application->save(); | |||||
| return $this->successResponse(); | return $this->successResponse(); | ||||
| } | } | ||||
| @@ -3,13 +3,28 @@ | |||||
| namespace App\Http\Controllers\Web\Customer; | namespace App\Http\Controllers\Web\Customer; | ||||
| use App\Http\Controllers\Web\BaseParam; | use App\Http\Controllers\Web\BaseParam; | ||||
| use App\Rules\Kana; | |||||
| use App\Rules\ZipCode; | |||||
| /** | /** | ||||
| * @property string name | |||||
| * @property string nameKana | |||||
| * @property string zipCode | |||||
| * @property string address | |||||
| * @property string phoneNo | |||||
| * @property ?string memo | |||||
| */ | */ | ||||
| class UpdateUserInfoOrderParam extends BaseParam | class UpdateUserInfoOrderParam extends BaseParam | ||||
| { | { | ||||
| public function rules(): array | public function rules(): array | ||||
| { | { | ||||
| return []; | |||||
| return [ | |||||
| 'name' => $this->str(), | |||||
| 'name_kana' => $this->str([new Kana()]), | |||||
| 'zip_code' => $this->str([new ZipCode()]), | |||||
| 'address' => $this->str(), | |||||
| 'phone_no' => $this->str(), | |||||
| 'memo' => $this->str(true), | |||||
| ]; | |||||
| } | } | ||||
| } | } | ||||
| @@ -40,6 +40,7 @@ class Customer extends KintoneModel | |||||
| protected const FIELD_NAMES = [ | protected const FIELD_NAMES = [ | ||||
| ...parent::FIELD_NAMES, | ...parent::FIELD_NAMES, | ||||
| self::FIELD_CUSTOMER_NAME => 'customer_name', | self::FIELD_CUSTOMER_NAME => 'customer_name', | ||||
| self::FIELD_CUSTOMER_NAME_KANA => 'customer_name_kana', | |||||
| self::FIELD_EMAIL => 'email', | self::FIELD_EMAIL => 'email', | ||||
| self::FIELD_ZIP_CODE => 'zip_code', | self::FIELD_ZIP_CODE => 'zip_code', | ||||
| self::FIELD_ADDRESS => 'address', | self::FIELD_ADDRESS => 'address', | ||||
| @@ -4,11 +4,24 @@ namespace App\Kintone\Models; | |||||
| /** | /** | ||||
| * アプリ名 各種申請 [利用者情報変更申請] | * アプリ名 各種申請 [利用者情報変更申請] | ||||
| * @property string nameBefore | |||||
| * @property string nameAfter | |||||
| * @property string nameKanaBefore | |||||
| * @property string nameKanaAfter | |||||
| * @property string zipCodeBefore | |||||
| * @property string zipCodeAfter | |||||
| * @property string addressBefore | |||||
| * @property string addressAfter | |||||
| * @property string phoneNoBefore | |||||
| * @property string phoneNoAfter | |||||
| * @property string memo | |||||
| */ | */ | ||||
| class UserInfoUpdateApplication extends GeneralApplication | class UserInfoUpdateApplication extends GeneralApplication | ||||
| { | { | ||||
| const FIELD_NAME_BEFORE = "利用者情報変更申請_変更前_氏名"; | const FIELD_NAME_BEFORE = "利用者情報変更申請_変更前_氏名"; | ||||
| const FIELD_NAME_AFTER = "利用者情報変更申請_変更後_氏名"; | const FIELD_NAME_AFTER = "利用者情報変更申請_変更後_氏名"; | ||||
| const FIELD_NAME_KANA_BEFORE = "利用者情報変更申請_変更前_氏名カナ"; | |||||
| const FIELD_NAME_KANA_AFTER = "利用者情報変更申請_変更後_氏名カナ"; | |||||
| const FIELD_ZIP_CODE_BEFORE = "利用者情報変更申請_変更前_郵便番号"; | const FIELD_ZIP_CODE_BEFORE = "利用者情報変更申請_変更前_郵便番号"; | ||||
| const FIELD_ZIP_CODE_AFTER = "利用者情報変更申請_変更後_郵便番号"; | const FIELD_ZIP_CODE_AFTER = "利用者情報変更申請_変更後_郵便番号"; | ||||
| const FIELD_ADDRESS_BEFORE = "利用者情報変更申請_変更前_住所"; | const FIELD_ADDRESS_BEFORE = "利用者情報変更申請_変更前_住所"; | ||||
| @@ -20,7 +33,9 @@ class UserInfoUpdateApplication extends GeneralApplication | |||||
| protected const FIELDS = [ | protected const FIELDS = [ | ||||
| ...parent::FIELDS, | ...parent::FIELDS, | ||||
| self::FIELD_NAME_BEFORE => FieldType::SINGLE_LINE_TEXT, | self::FIELD_NAME_BEFORE => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_NAME_BEFORE => FieldType::SINGLE_LINE_TEXT, | |||||
| self::FIELD_NAME_AFTER => FieldType::SINGLE_LINE_TEXT, | |||||
| self::FIELD_NAME_KANA_BEFORE => FieldType::SINGLE_LINE_TEXT, | |||||
| self::FIELD_NAME_KANA_AFTER => FieldType::SINGLE_LINE_TEXT, | |||||
| self::FIELD_ZIP_CODE_BEFORE => FieldType::SINGLE_LINE_TEXT, | self::FIELD_ZIP_CODE_BEFORE => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_ZIP_CODE_AFTER => FieldType::SINGLE_LINE_TEXT, | self::FIELD_ZIP_CODE_AFTER => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_ADDRESS_BEFORE => FieldType::SINGLE_LINE_TEXT, | self::FIELD_ADDRESS_BEFORE => FieldType::SINGLE_LINE_TEXT, | ||||
| @@ -15,9 +15,9 @@ class ZipCode extends BaseRule | |||||
| } | } | ||||
| public function check($value) : bool | |||||
| public function check($value): bool | |||||
| { | { | ||||
| return preg_match("/^\d{7}$/", $value) !== 0; | |||||
| return preg_match("/^\d{3}-\d{4}$/", $value) !== 0; | |||||
| } | } | ||||
| /** | /** | ||||