-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
定休日カレンダー機能を実装 #4974
Merged
Merged
定休日カレンダー機能を実装 #4974
Changes from 33 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
d154543
管理画面コンテンツ作成開始
d90544c
定休日新規登録処理実装
9688c91
更新・削除処理まで実装
3cfa0f3
フロント側処理実装中
4006a9c
Carbonでカレンダーデータ作成中
e9c0405
カレンダー取得処理など追加
aa6b8a1
2ヶ月分のカレンダー配列作成と前後の空白埋めを実装
c4a8e79
定休日マッチング実装中
bb3181b
定休日フラグ設定まではなんとかできた
28f69f2
カレンダーのスタイル以外は実装完了
e1183e7
重複チェック実装もれ発見。一旦コメントに記載。
a69a649
休業日文言追加と今日を強調するフラグ追加と表示対応
fff7dc4
定休日登録の重複チェックを実装
5a9aae8
不要コメントと不要useを削除
5715867
メッセージファイル修正
8c51ed1
dtb_blockのcsvデータを追加
b3f9345
Migrationファイルを追加
c15a3fa
日曜はじまりの2月の考慮処理を追加
394badf
インデント修正
89b7bfb
単体テスト追加
b51c09e
Webテスト実装中
171e6a1
管理画面の定休日カレンダー設定Webテスト実装完了
66ca6ab
未実装のテストをコメントアウト
043d9ee
スタイル追加と調整
2cdfcce
Webテスト実装
62fa8e4
タイポ修正
5d79b03
clearCacheの処理は不要なので削除
7825c91
削除メッセージをIDからタイトルへ修正
6e9bcc8
管理画面で定休日を修正した場合に重複チェックが発生するのを修正
8e18344
Create _12.9.calendar.scss
naomi-himoto 4a74ca9
scss微修正と土日の定休日表示対応
e504c32
土日をテンプレートで定休日と変更したためテストを修正
ab39712
ロケール考慮漏れで定休日設定がずれていたのを修正
ca5b8b7
文言をmessage.yamlに切り出し
10fc475
Merge branch '4.1' into feature/calendar
95f1a48
レビュー指摘反映
706fa42
ユニットテストが落ちていたのを修正
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20210316120000 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
// データ存在チェック | ||
$count = $this->connection->fetchColumn("SELECT COUNT(*) FROM dtb_block WHERE block_name = 'カレンダー'"); | ||
if ($count > 0) { | ||
return; | ||
} | ||
|
||
// idを取得する | ||
$id = $this->connection->fetchColumn('SELECT MAX(id) FROM dtb_block'); | ||
$id++; | ||
|
||
$this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'カレンダー', 'calendar', true, false, '2021-03-16 12:00:00', '2021-03-16 12:00:00', 10, 'block')"); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
113 changes: 113 additions & 0 deletions
113
html/template/default/assets/scss/project/_12.9.calendar.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
@import "../mixins/media"; | ||
@import "../mixins/clearfix"; | ||
|
||
/* | ||
見出し | ||
|
||
トップページで使用されているカレンダーのスタイルです。 | ||
|
||
ex [トップページ](http://demo3.ec-cube.net/) | ||
|
||
Markup: | ||
sg-wrapper: | ||
<div class="ec-role"> | ||
<sg-wrapper-content/> | ||
</div> | ||
|
||
Styleguide 12.9.1 | ||
*/ | ||
|
||
/* 背景や文字の色調整 */ | ||
$calander-default-bg: #F8F8F8;//月〜金までの背景色 | ||
$calander-default-color: #333;//月〜金までの文字色 | ||
$calander-sun-bg: #F8F8F8;//日曜の背景色 | ||
$calander-sun-color: #DE5D50;//日曜の文字色 | ||
$calander-sat-bg: #F8F8F8;//土曜の背景色 | ||
$calander-sat-color: #5CB1B1;//土曜の文字色 | ||
|
||
$calander-day-bg: #FFF;//日付の背景色 | ||
$calander-day-color: #333;//日付の文字色 | ||
$calander-holiday-bg: #FFF;//休日の背景色 | ||
$calander-holiday-color: #DE5D50;//休日の文字色 | ||
$calander-today-bg: #FFFDE7;//本日の背景色 | ||
$calander-today-color: #333;//本日の文字色 | ||
|
||
$calander-padding: 8px;//カレンダーの数字周りの余白 | ||
|
||
$calander-border: #f3f3f3;//カレンダーの線の色 | ||
|
||
|
||
|
||
.ec-calendar{ | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
|
||
@media screen and (min-width:768px){ | ||
flex-direction: row; | ||
margin-left: -30px; | ||
} | ||
|
||
&__month{ | ||
border-collapse: collapse; | ||
margin-top: 30px; | ||
@media screen and (min-width:768px){ | ||
margin-top: 0; | ||
margin-left: 30px; | ||
} | ||
|
||
th,td{ | ||
border-top: 1px solid $calander-border; | ||
border-bottom: 1px solid $calander-border; | ||
padding: $calander-padding; | ||
text-align: center; | ||
vertical-align: middle; | ||
}//th,td | ||
}//.ec-calendar__month | ||
& &__title{ | ||
border: 0; | ||
}//.ec-calendar__title | ||
& &__sun{ | ||
background: $calander-sun-bg; | ||
color: $calander-sun-color; | ||
}//.ec-calendar__sun | ||
& &__mon, | ||
& &__tue, | ||
& &__wed, | ||
& &__thu, | ||
& &__fri{ | ||
background: $calander-default-bg; | ||
color: $calander-default-color; | ||
} | ||
& &__sat{ | ||
background: $calander-sat-bg; | ||
color: $calander-sat-color; | ||
}//.ec-calendar__sat | ||
& &__day{ | ||
background: $calander-day-bg; | ||
color: $calander-day-color; | ||
}//.ec-calendar__day | ||
& &__holiday{ | ||
background: $calander-holiday-bg; | ||
color: $calander-holiday-color !important; | ||
}//.ec-calendar__holiday | ||
& &__today{ | ||
color: $calander-today-color; | ||
position: relative; | ||
z-index: 1; | ||
&::before{ | ||
content:""; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
display: block; | ||
width: 30px; | ||
height: 30px; | ||
border-radius: 50%; | ||
background: $calander-today-bg; | ||
transform: translate(-50%,-50%); | ||
z-index: -1; | ||
} | ||
}//.ec-calendar__today | ||
|
||
}//.ec-calendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
src/Eccube/Controller/Admin/Setting/Shop/CalendarController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of EC-CUBE | ||
* | ||
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
* | ||
* http://www.ec-cube.co.jp/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Eccube\Controller\Admin\Setting\Shop; | ||
|
||
use Eccube\Controller\AbstractController; | ||
use Eccube\Entity\Calendar; | ||
use Eccube\Form\Type\Admin\CalendarType; | ||
use Eccube\Repository\CalendarRepository; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
/** | ||
* Class CalendarController | ||
*/ | ||
class CalendarController extends AbstractController | ||
{ | ||
/** | ||
* @var CalendarRepository | ||
*/ | ||
protected $calendarRepository; | ||
|
||
/** | ||
* CalendarController constructor. | ||
* | ||
* @param CalendarRepository $calendarRepository | ||
*/ | ||
public function __construct(CalendarRepository $calendarRepository) | ||
{ | ||
$this->calendarRepository = $calendarRepository; | ||
} | ||
|
||
/** | ||
* カレンダー設定の初期表示・登録 | ||
* | ||
* @Route("/%eccube_admin_route%/setting/shop/calendar", name="admin_setting_shop_calendar") | ||
* @Route("/%eccube_admin_route%/setting/shop/calendar/new", name="admin_setting_shop_calendar_new") | ||
* @Template("@admin/Setting/Shop/calendar.twig") | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$Calendar = new Calendar(); | ||
$builder = $this->formFactory | ||
->createBuilder(CalendarType::class, $Calendar); | ||
|
||
$form = $builder->getForm(); | ||
|
||
$mode = $request->get('mode'); | ||
if ($mode != 'edit_inline') { | ||
$form->handleRequest($request); | ||
if ($form->isSubmitted() && $form->isValid()) { | ||
$this->entityManager->persist($Calendar); | ||
$this->entityManager->flush(); | ||
|
||
$this->addSuccess('admin.common.save_complete', 'admin'); | ||
|
||
return $this->redirectToRoute('admin_setting_shop_calendar'); | ||
} | ||
} | ||
|
||
// カレンダーリスト取得 | ||
$Calendars = $this->calendarRepository->getListOrderByIdDesc(); | ||
|
||
$forms = []; | ||
$errors = []; | ||
/** @var Calendar $Calendar */ | ||
foreach ($Calendars as $Calendar) { | ||
$builder = $this->formFactory->createBuilder(CalendarType::class, $Calendar); | ||
|
||
$editCalendarForm = $builder->getForm(); | ||
|
||
// error number | ||
$error = 0; | ||
if ($mode == 'edit_inline' | ||
&& $request->getMethod() === 'POST' | ||
&& (string) $Calendar->getId() === $request->get('calendar_id') | ||
) { | ||
$editCalendarForm->handleRequest($request); | ||
if ($editCalendarForm->isValid()) { | ||
$calendarData = $editCalendarForm->getData(); | ||
|
||
$this->entityManager->persist($calendarData); | ||
$this->entityManager->flush(); | ||
|
||
$this->addSuccess('admin.common.save_complete', 'admin'); | ||
|
||
return $this->redirectToRoute('admin_setting_shop_calendar'); | ||
} | ||
$error = count($editCalendarForm->getErrors(true)); | ||
} | ||
|
||
$forms[$Calendar->getId()] = $editCalendarForm->createView(); | ||
$errors[$Calendar->getId()] = $error; | ||
} | ||
|
||
return [ | ||
'Calendar' => $Calendar, | ||
'Calendars' => $Calendars, | ||
'form' => $form->createView(), | ||
'forms' => $forms, | ||
'errors' => $errors, | ||
]; | ||
} | ||
|
||
/** | ||
* カレンダー設定の削除 | ||
* | ||
* @Route("/%eccube_admin_route%/setting/shop/calendar/{id}/delete", requirements={"id" = "\d+"}, name="admin_setting_shop_calendar_delete", methods={"DELETE"}) | ||
*/ | ||
public function delete(Request $request, Calendar $Calendar) | ||
{ | ||
$this->isTokenValid(); | ||
$this->calendarRepository->delete($Calendar); | ||
$this->addSuccess('admin.common.delete_complete', 'admin'); | ||
|
||
return $this->redirectToRoute('admin_setting_shop_calendar'); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
methods={"GET", "POST"}
を指定お願いします