diff --git a/app/Http/Controllers/Web/Shop/Config/Printing/DisableController.php b/app/Http/Controllers/Web/Shop/Config/Printing/DisableController.php new file mode 100644 index 0000000..29d3a0c --- /dev/null +++ b/app/Http/Controllers/Web/Shop/Config/Printing/DisableController.php @@ -0,0 +1,47 @@ +param; + + $setting = ShopNoRelation::byKey( + $param->shopId, + $param->parkingManagementCode, + QRServiceUsage::印字方式 + ) + ->firstOrFail(); + + $setting->delete(); + + $setting->save(); + + return $this->successResponse(); + } +} diff --git a/app/Http/Controllers/Web/Shop/Config/Printing/DisableParam.php b/app/Http/Controllers/Web/Shop/Config/Printing/DisableParam.php new file mode 100644 index 0000000..b157b15 --- /dev/null +++ b/app/Http/Controllers/Web/Shop/Config/Printing/DisableParam.php @@ -0,0 +1,22 @@ + $this->str([...Rule::id()]), + ColumnName::PARKING_MANAGEMENT_CODE => $this->str([...Rule::parkingManagementCode()]), + ]; + } +} diff --git a/app/Http/Controllers/Web/Shop/Config/Printing/EnableController.php b/app/Http/Controllers/Web/Shop/Config/Printing/EnableController.php new file mode 100644 index 0000000..3ae7d2d --- /dev/null +++ b/app/Http/Controllers/Web/Shop/Config/Printing/EnableController.php @@ -0,0 +1,52 @@ +param; + + $setting = ShopNoRelation::byKey( + $param->shopId, + $param->parkingManagementCode, + QRServiceUsage::印字方式 + ) + ->firstOrNew(); + + $setting->fill( + [ + ...$param->toArray(), + ShopNoRelation::COL_NAME_QR_SERVICE_USEAGE => QRServiceUsage::印字方式, + ] + ); + + $setting->save(); + + return $this->successResponse(); + } +} diff --git a/app/Http/Controllers/Web/Shop/Config/Printing/EnableParam.php b/app/Http/Controllers/Web/Shop/Config/Printing/EnableParam.php new file mode 100644 index 0000000..cc178fb --- /dev/null +++ b/app/Http/Controllers/Web/Shop/Config/Printing/EnableParam.php @@ -0,0 +1,24 @@ + $this->str([...Rule::id()]), + ColumnName::PARKING_MANAGEMENT_CODE => $this->str([...Rule::parkingManagementCode()]), + ColumnName::SHOP_NO => $this->numeric([...Rule::shopNo()]), + ]; + } +} diff --git a/app/Http/Controllers/Web/Shop/Config/ShopConfigDetailController.php b/app/Http/Controllers/Web/Shop/Config/ShopConfigDetailController.php index 4b5c860..b9dadb4 100644 --- a/app/Http/Controllers/Web/Shop/Config/ShopConfigDetailController.php +++ b/app/Http/Controllers/Web/Shop/Config/ShopConfigDetailController.php @@ -3,11 +3,10 @@ namespace App\Http\Controllers\Web\Shop\Config; use App\Http\Controllers\Web\WebController; -use App\Logics\QRService\ChargeLogic; use App\Models\HtpmsCustomer\Mst\Shop; use App\Models\HtpmsCustomer\QRService\AcquisitionAvailableSetting; -use App\Models\HtpmsCustomer\QRService\CertificationAvailableSetting; use App\Repositories\CertificationAvailableSettingRepository; +use App\Repositories\PrintingAvailableSettingRepository; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -25,8 +24,11 @@ class ShopConfigDetailController extends WebController } - public function __construct(protected ShopConfigDetailParam $param, private CertificationAvailableSettingRepository $certificationRepository) - { + public function __construct( + protected ShopConfigDetailParam $param, + private CertificationAvailableSettingRepository $certificationRepository, + private PrintingAvailableSettingRepository $printingRepository, + ) { parent::__construct(); } @@ -43,12 +45,18 @@ class ShopConfigDetailController extends WebController $acquisition = AcquisitionAvailableSetting::whereShopId($param->shopId)->first(); + $printing = $this->printingRepository->get([ + ...$param->toArray(), + ]); + + $shop->save(); $res = [ "shop_id" => $param->shopId, "certification" => $certification, "acquisition" => $acquisition, + "printing" => $printing, ]; return $this->successResponse($res); diff --git a/app/Repositories/PrintingAvailableSettingRepository.php b/app/Repositories/PrintingAvailableSettingRepository.php new file mode 100644 index 0000000..1873888 --- /dev/null +++ b/app/Repositories/PrintingAvailableSettingRepository.php @@ -0,0 +1,74 @@ + + */ + public function get(array $condition): Collection + { + + $table = ShopNoRelation::getBuilder(static::TABLE_RELATION) + ->where(ShopNoRelation::COL_NAME_QR_SERVICE_USEAGE, QRServiceUsage::印字方式->value); + + $table->leftJoinSub(Parking::getBuilder(), static::TABLE_PARKING, function (JoinClause $join) { + $join->on( + $this->makeColumnName([static::TABLE_RELATION, ShopNoRelation::COL_NAME_PARKING_MANAGEMENT_CODE]), + $this->makeColumnName([static::TABLE_PARKING, Parking::COL_NAME_PARKING_MANAGEMENT_CODE]) + ); + }); + + // -----検索条件 + // GROUP_ID + $this->where($table, $condition, static::CONDITION_SHOP_ID, $this->makeColumnName([static::TABLE_RELATION, ShopNoRelation::COL_NAME_SHOP_ID])); + + + $table->select($this->columns()); + $table->orderBy($this->makeColumnName([self::TABLE_PARKING, Parking::COL_NAME_PARKING_MANAGEMENT_CODE])); + + $main = DB::connection("htpms_customer")->table($table, "main"); + + // ソート + $this->sort($main, $condition); + + // リミット + $this->limit($main, $condition); + + return CertificationAvailableSettingRepositoryData::makeList($main->get()); + } + + private function columns() + { + $relation = static::TABLE_RELATION; + $parking = static::TABLE_PARKING; + $columns = [ + $this->makeColumnNameForSelect([$relation, ShopNoRelation::COL_NAME_SHOP_ID]), + $this->makeColumnNameForSelect([$relation, ShopNoRelation::COL_NAME_PARKING_MANAGEMENT_CODE]), + $this->makeColumnNameForSelect([$relation, ShopNoRelation::COL_NAME_SHOP_NO]), + $this->makeColumnNameForSelect([$parking, Parking::COL_NAME_PARKING_NAME], "parking_name"), + ]; + + return $columns; + } +} diff --git a/app/Repositories/PrintingAvailableSettingRepositoryData.php b/app/Repositories/PrintingAvailableSettingRepositoryData.php new file mode 100644 index 0000000..15ca70b --- /dev/null +++ b/app/Repositories/PrintingAvailableSettingRepositoryData.php @@ -0,0 +1,14 @@ +group(function () { RouteHelper::post('/shop/config/certification/add', App\Http\Controllers\Web\Shop\Config\Certification\AddController::class); RouteHelper::post('/shop/config/certification/remove', App\Http\Controllers\Web\Shop\Config\Certification\RemoveController::class); RouteHelper::post('/shop/config/certification/delete', App\Http\Controllers\Web\Shop\Config\Certification\DeleteController::class); + RouteHelper::post('/shop/config/printing/enable', App\Http\Controllers\Web\Shop\Config\Printing\EnableController::class); + RouteHelper::post('/shop/config/printing/disable', App\Http\Controllers\Web\Shop\Config\Printing\DisableController::class); RouteHelper::post('/shop/config/acquisition/enable', App\Http\Controllers\Web\Shop\Config\Acquisition\EnableController::class); RouteHelper::post('/shop/config/acquisition/disable', App\Http\Controllers\Web\Shop\Config\Acquisition\DisableController::class); RouteHelper::get('/qr-service/parking-group/list', App\Http\Controllers\Web\QRService\Group\QRServiceGroupListController::class);