Add movie sessions poster

This commit is contained in:
Amanmyrat 2023-08-26 12:29:03 +05:00
parent 33a10d441a
commit d042f34a93
18 changed files with 384 additions and 29 deletions

View File

@ -0,0 +1,18 @@
<?php namespace Tps\Movies\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class MovieSessions extends Controller
{
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController' ];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Tps.Movies', 'main-menu-item', 'side-menu-item');
}
}

View File

@ -0,0 +1,18 @@
<div data-control="toolbar">
<a href="<?= Backend::url('tps/movies/moviesessions/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"
onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked')
})"
data-request="onDelete"
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator>
<?= e(trans('backend::lang.list.delete_selected')) ?>
</button>
</div>

View File

@ -0,0 +1,10 @@
name: MovieSessions
form: $/tps/movies/models/moviesession/fields.yaml
modelClass: Tps\Movies\Models\MovieSession
defaultRedirect: tps/movies/moviesessions
create:
redirect: 'tps/movies/moviesessions/update/:id'
redirectClose: tps/movies/moviesessions
update:
redirect: tps/movies/moviesessions
redirectClose: tps/movies/moviesessions

View File

@ -0,0 +1,12 @@
list: $/tps/movies/models/moviesession/columns.yaml
modelClass: Tps\Movies\Models\MovieSession
title: MovieSessions
noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
toolbar:
buttons: list_toolbar
search:
prompt: 'backend::lang.list.search_prompt'
recordUrl: 'tps/movies/moviesessions/update/:id'

View File

@ -0,0 +1,46 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/movies/moviesessions') ?>">MovieSessions</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/movies/moviesessions') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('tps/movies/moviesessions') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1 @@
<?= $this->listRender() ?>

View File

@ -0,0 +1,22 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/movies/moviesessions') ?>">MovieSessions</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<?php endif ?>
<p>
<a href="<?= Backend::url('tps/movies/moviesessions') ?>" class="btn btn-default oc-icon-chevron-left">
<?= e(trans('backend::lang.form.return_to_list')) ?>
</a>
</p>

View File

@ -0,0 +1,54 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/movies/moviesessions') ?>">MovieSessions</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/movies/moviesessions') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('tps/movies/moviesessions') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1,33 @@
<?php namespace Tps\Movies\Models;
use Model;
/**
* Model
*/
class MovieSession extends Model
{
use \October\Rain\Database\Traits\Validation;
/*
* Disable timestamps by default.
* Remove this line if timestamps are defined in the database table.
*/
public $timestamps = false;
/**
* @var string The database table used by the model.
*/
public $table = 'tps_movies_sessions';
/**
* @var array Validation rules
*/
public $rules = [
];
public $attachOne = [
'image' => 'Tps\Shops\Classes\Attachment',
];
}

View File

@ -0,0 +1,7 @@
columns:
id:
label: id
type: number
title:
label: title
type: text

View File

@ -0,0 +1,14 @@
fields:
title:
label: Title
span: auto
type: text
image:
label: Image
mode: image
useCaption: true
thumbOptions:
mode: crop
extension: auto
span: auto
type: fileupload

View File

@ -9,3 +9,12 @@ navigation:
label: Movies
url: tps/movies/movies
icon: icon-film
sideMenu:
side-menu-item2:
label: Movies
url: tps/movies/movies
icon: icon-film
side-menu-item:
label: 'Movie Sessions'
url: tps/movies/moviesessions
icon: icon-file-movie-o

View File

@ -0,0 +1,22 @@
<?php namespace Tps\Movies\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateTpsMoviesSessions extends Migration
{
public function up()
{
Schema::create('tps_movies_sessions', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('title')->nullable();
});
}
public function down()
{
Schema::dropIfExists('tps_movies_sessions');
}
}

View File

@ -9,3 +9,6 @@
1.0.4:
- 'Updated table tps_movies_'
- builder_table_update_tps_movies__2.php
1.0.5:
- 'Created table tps_movies_sessions'
- builder_table_create_tps_movies_sessions.php

View File

@ -559,7 +559,7 @@
align-items: center;
justify-content: center;
a {
h6 {
display: flex;
align-items: center;
@ -590,6 +590,25 @@
}
}
&_poster {
.inner {
width: calc(100% - 30px);
max-width: 510px;
height: unset;
max-height: calc(100% - 20px);
background: unset;
}
&-photo {
width: 100%;
img {
@include ImgCon;
display: block;
}
}
}
}
@keyframes movie-bg {

View File

@ -1869,7 +1869,7 @@ input[type=date]::-webkit-calendar-picker-indicator {
-ms-flex-pack: center;
justify-content: center;
}
.movie_all a {
.movie_all h6 {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
@ -1886,23 +1886,40 @@ input[type=date]::-webkit-calendar-picker-indicator {
border-radius: 10px;
margin-top: 140px;
}
.movie_all a span {
.movie_all h6 span {
width: 15px;
height: 15px;
display: block;
margin-left: 10px;
}
.movie_all a span svg {
.movie_all h6 span svg {
width: 100%;
height: 100%;
object-fit: contain;
-o-object-fit: contain;
}
.movie_all a span svg path {
.movie_all h6 span svg path {
-webkit-transition: all 0.2s ease-in-out 0s;
transition: all 0.2s ease-in-out 0s;
-moz-transition: all 0.2s ease-in-out 0s;
}
.movie_poster .inner {
width: calc(100% - 30px);
max-width: 510px;
height: unset;
max-height: calc(100% - 20px);
background: unset;
}
.movie_poster-photo {
width: 100%;
}
.movie_poster-photo img {
width: 100%;
height: 100%;
object-fit: contain;
-o-object-fit: contain;
display: block;
}
@keyframes movie-bg {
0% {

View File

@ -19,8 +19,10 @@ let mobile_link = document.querySelectorAll('.mobile_buttons-link');
let logout = document.querySelector('.logout');
let logout_link = document.querySelectorAll('.logout a');
let movie_link = document.querySelectorAll('.movie_item-link');
let movie_poster = document.querySelector('.movie_all h6');
// let movie_link = document.querySelectorAll('.movie_item-link');
let modal_close = document.querySelectorAll('.modal_close');
@ -145,16 +147,33 @@ if (user_title != undefined) {
});
}
// if (movie_link != undefined) {
// movie_link.forEach(x => {
// x.addEventListener('click', function () {
// sleep(2).then(() => {
// console.log("klkl")
// body.classList.add('active');
// });
// });
// })
// }
if (movie_link != undefined) {
movie_link.forEach(x => {
x.addEventListener('click', function () {
sleep(2).then(() => {
body.classList.add('active');
});
});
})
}
if (movie_poster != undefined) {
movie_poster.addEventListener('click', function () {
sleep(2).then(() => {
body.classList.add('active');
})
});
}
if (modal_close != undefined) {
modal_close.forEach(x => {
x.addEventListener('click', function () {
sleep(2).then(() => {
body.classList.remove('active');
});
});
})
}

View File

@ -1,4 +1,10 @@
==
<?php
function onStart(){
$this['poster'] = Tps\Movies\Models\MovieSession::orderBy('id', 'desc')->limit(1)->get()->first();
}
?>
==
<section class="movie">
<div class="auto_container">
<div class="movie_wrap">
@ -42,17 +48,17 @@
alt="movie-photo"
/>
</div>
<h4 class="movie_item-title">{{movie.name}}</h4>
<h6 class="movie_item-genre">{{movie.genras}}</h6>
</div>
<h4
class="movie_item-link modBtn"
onclick="return showMovieDetails({{ movie|json_encode() }}, {{ movie.image.path|json_encode() }});">
Узнать подробней
<span>
<svg
width="14"
@ -71,24 +77,49 @@
{% endfor %}
</div>
<div class="movie_all">
<a href="#">
{% if poster %}
<div class="movie_all modBtn" data-tab="#movie_poster">
<h6 class="">
Показать все сеансы
<span>
<svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.16732 6.83329H11.0507L8.02565 10.4666C7.95561 10.5509 7.90286 10.6481 7.8704 10.7528C7.83794 10.8574 7.82641 10.9675 7.83647 11.0766C7.85678 11.2969 7.9638 11.5002 8.13398 11.6416C8.30416 11.7831 8.52356 11.8511 8.74392 11.8308C8.96428 11.8105 9.16753 11.7035 9.30898 11.5333L13.4756 6.5333C13.5037 6.49353 13.5288 6.45175 13.5507 6.40829C13.5507 6.36663 13.5923 6.34163 13.609 6.29996C13.6468 6.20441 13.6665 6.1027 13.6673 5.99996C13.6665 5.89722 13.6468 5.79551 13.609 5.69996C13.609 5.6583 13.5673 5.6333 13.5507 5.59163C13.5288 5.54818 13.5037 5.5064 13.4756 5.46663L9.30898 0.466628C9.23063 0.372559 9.13251 0.296909 9.02161 0.245058C8.91071 0.193207 8.78974 0.166429 8.66732 0.166628C8.47261 0.166247 8.28391 0.23406 8.13398 0.358294C8.0496 0.428252 7.97985 0.514169 7.92872 0.611125C7.8776 0.708081 7.8461 0.814171 7.83604 0.923318C7.82597 1.03247 7.83754 1.14253 7.87008 1.2472C7.90262 1.35187 7.95548 1.44909 8.02565 1.53329L11.0507 5.16663H1.16732C0.946304 5.16663 0.734342 5.25443 0.578062 5.41071C0.421782 5.56699 0.333984 5.77895 0.333984 5.99996C0.333984 6.22098 0.421782 6.43294 0.578062 6.58922C0.734342 6.7455 0.946304 6.83329 1.16732 6.83329Z" fill="#292929"></path>
<svg width="14" height="12" viewBox="0 0 14 12" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M1.16732 6.83329H11.0507L8.02565 10.4666C7.95561 10.5509 7.90286 10.6481 7.8704 10.7528C7.83794 10.8574 7.82641 10.9675 7.83647 11.0766C7.85678 11.2969 7.9638 11.5002 8.13398 11.6416C8.30416 11.7831 8.52356 11.8511 8.74392 11.8308C8.96428 11.8105 9.16753 11.7035 9.30898 11.5333L13.4756 6.5333C13.5037 6.49353 13.5288 6.45175 13.5507 6.40829C13.5507 6.36663 13.5923 6.34163 13.609 6.29996C13.6468 6.20441 13.6665 6.1027 13.6673 5.99996C13.6665 5.89722 13.6468 5.79551 13.609 5.69996C13.609 5.6583 13.5673 5.6333 13.5507 5.59163C13.5288 5.54818 13.5037 5.5064 13.4756 5.46663L9.30898 0.466628C9.23063 0.372559 9.13251 0.296909 9.02161 0.245058C8.91071 0.193207 8.78974 0.166429 8.66732 0.166628C8.47261 0.166247 8.28391 0.23406 8.13398 0.358294C8.0496 0.428252 7.97985 0.514169 7.92872 0.611125C7.8776 0.708081 7.8461 0.814171 7.83604 0.923318C7.82597 1.03247 7.83754 1.14253 7.87008 1.2472C7.90262 1.35187 7.95548 1.44909 8.02565 1.53329L11.0507 5.16663H1.16732C0.946304 5.16663 0.734342 5.25443 0.578062 5.41071C0.421782 5.56699 0.333984 5.77895 0.333984 5.99996C0.333984 6.22098 0.421782 6.43294 0.578062 6.58922C0.734342 6.7455 0.946304 6.83329 1.16732 6.83329Z"
fill="#292929" />
</svg>
</span>
</a>
</h6>
</div>
{% endif %}
</div>
</div>
</section>
<div class="modal movie_desc" id="movie_desc"></div>
{% if poster %}
<!-- Movie poster modal ================ -->
<div class="modal movie_poster mod" id="movie_poster">
<div class="inner">
<div class="modal_close modClose" data-mod="movie_poster">
<svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="20.4" cy="20" rx="20.4" ry="20" fill="white" />
<path
d="M21.8796 19.8865L27.6082 14.189C27.859 13.939 28 13.5998 28 13.2461C28 12.8924 27.859 12.5533 27.6082 12.3032C27.3573 12.0531 27.0171 11.9126 26.6623 11.9126C26.3075 11.9126 25.9673 12.0531 25.7164 12.3032L20.0011 18.0139L14.2858 12.3032C14.035 12.0531 13.6947 11.9126 13.34 11.9126C12.9852 11.9126 12.6449 12.0531 12.3941 12.3032C12.1432 12.5533 12.0023 12.8924 12.0023 13.2461C12.0023 13.5998 12.1432 13.939 12.3941 14.189L18.1227 19.8865L12.3941 25.584C12.2692 25.7074 12.1701 25.8543 12.1025 26.0162C12.0348 26.178 12 26.3516 12 26.5269C12 26.7022 12.0348 26.8758 12.1025 27.0376C12.1701 27.1995 12.2692 27.3464 12.3941 27.4698C12.5179 27.5943 12.6653 27.6931 12.8276 27.7605C12.99 27.828 13.1641 27.8627 13.34 27.8627C13.5158 27.8627 13.69 27.828 13.8523 27.7605C14.0147 27.6931 14.162 27.5943 14.2858 27.4698L20.0011 21.7591L25.7164 27.4698C25.8403 27.5943 25.9876 27.6931 26.15 27.7605C26.3123 27.828 26.4864 27.8627 26.6623 27.8627C26.8382 27.8627 27.0123 27.828 27.1746 27.7605C27.337 27.6931 27.4843 27.5943 27.6082 27.4698C27.7331 27.3464 27.8322 27.1995 27.8998 27.0376C27.9674 26.8758 28.0023 26.7022 28.0023 26.5269C28.0023 26.3516 27.9674 26.178 27.8998 26.0162C27.8322 25.8543 27.7331 25.7074 27.6082 25.584L21.8796 19.8865Z"
fill="#292929" />
</svg>
</div>
<div class="movie_poster-photo">
<img src="{{poster.image.path}}" alt="poster-photo">
</div>
</div>
</div>
{% endif %}
<!-- Movie poster modal end ============ -->
<script>
function closeMovieModal() {
document.getElementById("movie_desc").classList.remove("active");
@ -96,8 +127,8 @@
function showMovieDetails(movie, image) {
var movieBox = document.getElementById("movie_desc");
movieBox.innerHTML = "";
movieBox.innerHTML = "";
let content = `
<div class="inner">
<div class="modal_close" onclick="return closeMovieModal();">
@ -194,4 +225,4 @@
movieBox.insertAdjacentHTML("beforeend", content);
movieBox.classList.add("active");
}
</script>
</script>