2017-11-05 19:14:36 +09:00
|
|
|
@extends('layouts.base')
|
2017-08-27 04:44:53 +09:00
|
|
|
|
2019-01-08 23:27:48 +09:00
|
|
|
@section('title', 'チェックイン')
|
|
|
|
|
2017-08-27 04:44:53 +09:00
|
|
|
@section('content')
|
|
|
|
<div class="container">
|
2017-11-05 19:14:36 +09:00
|
|
|
<h2>今致してる?</h2>
|
|
|
|
<hr>
|
|
|
|
<div class="row justify-content-center mt-5">
|
|
|
|
<div class="col-lg-6">
|
2017-11-06 00:49:10 +09:00
|
|
|
<form method="post" action="{{ route('checkin') }}">
|
2017-11-05 19:14:36 +09:00
|
|
|
{{ csrf_field() }}
|
2017-08-27 04:44:53 +09:00
|
|
|
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-sm-6">
|
|
|
|
<label for="date"><span class="oi oi-calendar"></span> 日付</label>
|
|
|
|
<input id="date" name="date" type="text" class="form-control {{ $errors->has('date') || $errors->has('datetime') ? ' is-invalid' : '' }}"
|
2018-03-06 22:43:49 +09:00
|
|
|
pattern="^20[0-9]{2}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$" value="{{ old('date') ?? $defaults['date'] }}" required>
|
2017-08-27 04:44:53 +09:00
|
|
|
|
|
|
|
@if ($errors->has('date'))
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="invalid-feedback">{{ $errors->first('date') }}</div>
|
2017-08-27 04:44:53 +09:00
|
|
|
@endif
|
|
|
|
</div>
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="form-group col-sm-6">
|
|
|
|
<label for="time"><span class="oi oi-clock"></span> 時刻</label>
|
|
|
|
<input id="time" name="time" type="text" class="form-control {{ $errors->has('time') || $errors->has('datetime') ? ' is-invalid' : '' }}"
|
2018-03-06 22:43:49 +09:00
|
|
|
pattern="^([01][0-9]|2[0-3]):[0-5][0-9]$" value="{{ old('time') ?? $defaults['time'] }}" required>
|
2017-08-27 04:44:53 +09:00
|
|
|
|
|
|
|
@if ($errors->has('time'))
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="invalid-feedback">{{ $errors->first('time') }}</div>
|
2017-08-27 04:44:53 +09:00
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
@if ($errors->has('datetime'))
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="form-group col-sm-12" style="margin-top: -1rem;">
|
|
|
|
<small class="text-danger">{{ $errors->first('datetime') }}</small>
|
|
|
|
</div>
|
2017-08-27 04:44:53 +09:00
|
|
|
@endif
|
2017-11-05 19:14:36 +09:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-sm-12">
|
2018-03-06 22:43:49 +09:00
|
|
|
<input name="tags" type="hidden" value="{{ old('tags') ?? $defaults['tags'] }}">
|
2018-01-08 01:02:27 +09:00
|
|
|
<label for="tagInput"><span class="oi oi-tags"></span> タグ</label>
|
|
|
|
<div class="form-control {{ $errors->has('tags') ? ' is-invalid' : '' }}">
|
|
|
|
<ul id="tags" class="list-inline d-inline"></ul>
|
|
|
|
<input id="tagInput" type="text" style="outline: 0; border: 0;">
|
|
|
|
</div>
|
2017-11-05 19:14:36 +09:00
|
|
|
<small class="form-text text-muted">
|
2018-01-08 01:02:27 +09:00
|
|
|
Tab, Enter, 半角スペースのいずれかで入力確定します。
|
2017-11-05 19:14:36 +09:00
|
|
|
</small>
|
2018-01-08 01:02:27 +09:00
|
|
|
|
|
|
|
@if ($errors->has('tags'))
|
|
|
|
<div class="invalid-feedback">{{ $errors->first('tags') }}</div>
|
|
|
|
@endif
|
2017-08-27 04:44:53 +09:00
|
|
|
</div>
|
2017-11-05 19:14:36 +09:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-sm-12">
|
|
|
|
<label for="link"><span class="oi oi-link-intact"></span> オカズリンク</label>
|
2018-09-08 00:19:50 +09:00
|
|
|
<input id="link" name="link" type="text" autocomplete="off" class="form-control {{ $errors->has('link') ? ' is-invalid' : '' }}" placeholder="http://..." value="{{ old('link') ?? $defaults['link'] }}">
|
2017-11-05 19:14:36 +09:00
|
|
|
<small class="form-text text-muted">
|
|
|
|
オカズのURLを貼り付けて登録することができます。
|
|
|
|
</small>
|
2018-01-05 00:26:48 +09:00
|
|
|
@if ($errors->has('link'))
|
|
|
|
<div class="invalid-feedback">{{ $errors->first('link') }}</div>
|
|
|
|
@endif
|
2017-11-05 19:14:36 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-sm-12">
|
|
|
|
<label for="note"><span class="oi oi-comment-square"></span> ノート</label>
|
2018-03-06 22:43:49 +09:00
|
|
|
<textarea id="note" name="note" class="form-control {{ $errors->has('note') ? ' is-invalid' : '' }}" rows="4">{{ old('note') ?? $defaults['note'] }}</textarea>
|
2017-11-05 19:14:36 +09:00
|
|
|
<small class="form-text text-muted">
|
|
|
|
最大 500 文字
|
|
|
|
</small>
|
2017-08-27 04:44:53 +09:00
|
|
|
@if ($errors->has('note'))
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="invalid-feedback">{{ $errors->first('note') }}</div>
|
2017-08-27 04:44:53 +09:00
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-11-05 19:14:36 +09:00
|
|
|
<div class="form-row mt-4">
|
|
|
|
<p>オプション</p>
|
|
|
|
<div class="form-group col-sm-12">
|
2018-06-12 22:44:07 +09:00
|
|
|
<div class="custom-control custom-checkbox mb-3">
|
|
|
|
<input id="isPrivate" name="is_private" type="checkbox" class="custom-control-input" {{ old('is_private') || $defaults['is_private'] ? 'checked' : '' }}>
|
|
|
|
<label class="custom-control-label" for="isPrivate">
|
|
|
|
<span class="oi oi-lock-locked"></span> このチェックインを非公開にする
|
2017-11-05 19:14:36 +09:00
|
|
|
</label>
|
|
|
|
</div>
|
2017-08-27 04:44:53 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-11-05 19:14:36 +09:00
|
|
|
|
|
|
|
<div class="text-center">
|
|
|
|
<button class="btn btn-primary" type="submit">チェックイン</button>
|
2017-08-27 04:44:53 +09:00
|
|
|
</div>
|
2017-11-05 19:14:36 +09:00
|
|
|
</form>
|
|
|
|
</div>
|
2017-08-27 04:44:53 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
|
2017-11-05 19:14:36 +09:00
|
|
|
@push('script')
|
2018-01-08 01:02:27 +09:00
|
|
|
<script>
|
|
|
|
function updateTags() {
|
|
|
|
$('input[name=tags]').val(
|
|
|
|
$('#tags')
|
|
|
|
.find('li')
|
|
|
|
.map(function () {
|
|
|
|
return $(this).data('value');
|
|
|
|
})
|
|
|
|
.get()
|
|
|
|
.join(' ')
|
|
|
|
);
|
|
|
|
}
|
2018-01-08 08:50:22 +09:00
|
|
|
function insertTag(value) {
|
|
|
|
$('#tags').append('<li class="list-inline-item badge badge-primary" style="cursor: pointer;" data-value="' + value + '"><span class="oi oi-tag"></span> ' + value + ' | x</li>');
|
|
|
|
}
|
|
|
|
var initTags = $('input[name=tags]').val();
|
|
|
|
if (initTags.trim() !== '') {
|
|
|
|
initTags.split(' ').forEach(function (value) {
|
|
|
|
insertTag(value);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-01-08 01:02:27 +09:00
|
|
|
$('#tagInput').on('keydown', function (ev) {
|
|
|
|
var $this = $(this);
|
|
|
|
if ($this.val().trim() !== '') {
|
|
|
|
switch (ev.key) {
|
|
|
|
case 'Tab':
|
|
|
|
case 'Enter':
|
|
|
|
case ' ':
|
2018-01-08 08:50:22 +09:00
|
|
|
insertTag($this.val().trim());
|
2018-01-08 01:02:27 +09:00
|
|
|
$this.val('');
|
|
|
|
updateTags();
|
|
|
|
ev.preventDefault();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (ev.key === 'Enter') {
|
|
|
|
// 誤爆防止
|
|
|
|
ev.preventDefault();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#tags')
|
|
|
|
.on('click', 'li', function (ev) {
|
|
|
|
$(this).remove();
|
|
|
|
updateTags();
|
|
|
|
})
|
|
|
|
.parent()
|
|
|
|
.on('click', function (ev) {
|
|
|
|
$('#tagInput').focus();
|
|
|
|
});
|
|
|
|
</script>
|
2017-11-05 19:14:36 +09:00
|
|
|
@endpush
|