Bläddra i källkod

利用者情報変更申請 整備

master
sosuke.iwabuchi 2 år sedan
förälder
incheckning
d1f6cd9520
6 ändrade filer med 66 tillägg och 11 borttagningar
  1. +0
    -2
      app/Email/Members/UserInfoUpdateOrderNotice.php
  2. +31
    -5
      app/Http/Controllers/Web/Customer/UpdateUserInfoOrderController.php
  3. +16
    -1
      app/Http/Controllers/Web/Customer/UpdateUserInfoOrderParam.php
  4. +1
    -0
      app/Kintone/Models/Customer.php
  5. +16
    -1
      app/Kintone/Models/UserInfoUpdateApplication.php
  6. +2
    -2
      app/Rules/ZipCode.php

+ 0
- 2
app/Email/Members/UserInfoUpdateOrderNotice.php Visa fil

@@ -3,7 +3,6 @@
namespace App\Email\Members;

use App\Kintone\Models\Customer;
use App\Kintone\Models\SeasonTicketContract;
use App\Kintone\Models\UserInfoUpdateApplication;

class UserInfoUpdateOrderNotice extends Members
@@ -11,7 +10,6 @@ class UserInfoUpdateOrderNotice extends Members

public function __construct(
protected Customer $customer,
private SeasonTicketContract $seasonTicketContract,
private UserInfoUpdateApplication $app
) {
parent::__construct($customer);


+ 31
- 5
app/Http/Controllers/Web/Customer/UpdateUserInfoOrderController.php Visa fil

@@ -2,9 +2,12 @@

namespace App\Http\Controllers\Web\Customer;

use App\Email\Members\ParkingCertificateOrderNotice;
use App\Email\Members\UserInfoUpdateOrderNotice;
use App\Http\Controllers\Web\WebController;
use App\Kintone\Models\Customer;
use App\Kintone\Models\UserInfoUpdateApplication;
use App\Logic\EmailManager;
use App\Logic\GeneralApplicationManager;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -31,12 +34,35 @@ class UpdateUserInfoOrderController extends WebController

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();
}


+ 16
- 1
app/Http/Controllers/Web/Customer/UpdateUserInfoOrderParam.php Visa fil

@@ -3,13 +3,28 @@
namespace App\Http\Controllers\Web\Customer;

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
{
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),
];
}
}

+ 1
- 0
app/Kintone/Models/Customer.php Visa fil

@@ -40,6 +40,7 @@ class Customer extends KintoneModel
protected const FIELD_NAMES = [
...parent::FIELD_NAMES,
self::FIELD_CUSTOMER_NAME => 'customer_name',
self::FIELD_CUSTOMER_NAME_KANA => 'customer_name_kana',
self::FIELD_EMAIL => 'email',
self::FIELD_ZIP_CODE => 'zip_code',
self::FIELD_ADDRESS => 'address',


+ 16
- 1
app/Kintone/Models/UserInfoUpdateApplication.php Visa fil

@@ -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
{
const FIELD_NAME_BEFORE = "利用者情報変更申請_変更前_氏名";
const FIELD_NAME_AFTER = "利用者情報変更申請_変更後_氏名";
const FIELD_NAME_KANA_BEFORE = "利用者情報変更申請_変更前_氏名カナ";
const FIELD_NAME_KANA_AFTER = "利用者情報変更申請_変更後_氏名カナ";
const FIELD_ZIP_CODE_BEFORE = "利用者情報変更申請_変更前_郵便番号";
const FIELD_ZIP_CODE_AFTER = "利用者情報変更申請_変更後_郵便番号";
const FIELD_ADDRESS_BEFORE = "利用者情報変更申請_変更前_住所";
@@ -20,7 +33,9 @@ class UserInfoUpdateApplication extends GeneralApplication
protected const FIELDS = [
...parent::FIELDS,
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_AFTER => FieldType::SINGLE_LINE_TEXT,
self::FIELD_ADDRESS_BEFORE => FieldType::SINGLE_LINE_TEXT,


+ 2
- 2
app/Rules/ZipCode.php Visa fil

@@ -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;
}

/**


Laddar…
Avbryt
Spara