File: /home/artinside/sites.artinside.com.br/iande/themes/admin/widgets/cases/case.php
<?php
$this->layout("_admin"); ?>
<?php
$this->start("css") ?>
<link rel="stylesheet" type="text/css" href="<?= url("admin-assets/css/gallery.css"); ?>"/>
<?php
$this->end(); ?>
<!-- importante para reposiçao de imagens que ultrapassam limite -->
<?php if(!$cases):?>
<img class="radius img-open" style="width: 20%; display: none;" src="<?= url("/storage/sistema/no-img.jpg") ?>" id="old-file"/>
<?php else: ?>
<img class="radius img-open" style="width: 20%; display: none" src="<?= image($cases->cover, 400); ?>" id="old-file"/>
<?php endif; ?>
<div class="mce_upload" style="z-index: 1001 !important;">
<div class="mce_upload_box">
<form class="app_form" action="<?= url("/admin/cases/case"); ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="upload" value="true"/>
<label>
<label class="legend">Selecione uma imagem JPG ou PNG:</label>
<input accept="image/*" type="file" name="image" required class="form-control"/>
</label>
<button class="btn btn-danger icon-upload">Enviar Imagem</button>
</form>
</div>
</div>
<section class="wrapper">
<?php
if (!$cases): ?>
<div class="row">
<div class="col-12 text-center my-4 text-sm-center">
<h3> Novo Case</h3>
<p>Crie um novo Case </p>
</div>
<div class="col-lg-9">
<section class="card">
<header class="card-header infinity-bg white-text">
Cadastrar Case
</header>
<div class="card-body">
<form class="form-horizontal tasi-form" method="post" action="<?= url("/admin/cases/case"); ?>">
<input type="hidden" name="action" value="create"/>
<div class="form-group row" hidden>
<label class="col-sm-2 col-sm-2 control-label">Capa (1920x1080px)</label>
<div class="col-sm-10">
<input type="file" name="cover" placeholder="Uma imagem de capa"
class="form-control" id="j_img_preview"/>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-sm-2 control-label">Título*</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title">
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-sm-2 control-label">Subtítulo*</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="subtitle">
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Desafio de negócio*</label>
<textarea name="content1" class="form-control mce"></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Inspiração natural *</label>
<textarea name="content2" class="form-control mce"></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Solução*</label>
<textarea name="content3" class="form-control mce"></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Resultado*</label>
<textarea name="content4" class="form-control mce"></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-lg-6">
<label class="control-label">Data de publicação:</label>
<input class="mask-datetime form-control" type="text" name="post_at"
value="<?= date("d/m/Y H:i"); ?>"
required/>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
<div class="col-lg-6">
<label class="control-label">Cliente/Parceiro:</label>
<select name="brand_id" class="form-control" required>
<?php
foreach ($brands as $brand): ?>
<option value="<?= $brand->id; ?>"><?= $brand->title; ?></option>
<?php
endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Tipo de Case</label>
<div class="custom-control custom-radio mb-3">
<input type="radio" id="customRadio1" name="status" class="custom-control-input"
value="1" checked>
<label class="custom-control-label" for="customRadio1">Case Iandé</label>
</div>
<div class="custom-control custom-radio mb-3">
<input type="radio" id="customRadio2" name="status" value="2"
class="custom-control-input">
<label class="custom-control-label" for="customRadio2">Case de Mercado</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Galeria</label>
<input type="file" name="gallery[]" placeholder="Uma imagem de capa"
class="form-control" multiple id="gallery-upload"/>
<span class="help-block">Envie até 10 imagens por vez para não sobrecarregar o sistema</span>
</div>
</div>
<button class="btn btn-primary" type="submit">Publicar</button>
<a class="btn btn-danger" href="<?= url("/admin/cases/home"); ?>">Cancelar</a>
</form>
</div>
</section>
</div>
<div class="col-lg-3">
<section class="card">
<header class="card-header infinity-bg white-text text-center">
Imagem de capa
</header>
<img class="radius img-open" style="width: 100%;" src="<?= url("/storage/sistema/no-img.jpg") ?>"
id="image-preview"/>
</section>
</div>
</div>
<?php
else: ?>
<div class="row">
<div class="col-12 text-center my-4 text-sm-center">
<h4> Editar post [<?= $cases->title; ?>] #<?= $cases->id; ?> </h4>
<p><a class="icon-link btn btn-success" href="<?= url("/cases{$cases->uri}"); ?>" target="_blank"
title="">Ver no
site</a></p>
</div>
<div class="col-lg-9">
<section class="card">
<header class="card-header infinity-bg white-text">
Editar Cases
</header>
<div class="card-body">
<form class="form-horizontal tasi-form" method="post"
action="<?= url("/admin/cases/case/{$cases->id}"); ?>">
<input type="hidden" name="action" value="update"/>
<div class="form-group row" hidden>
<label class="col-sm-2 col-sm-2 control-label">Capa (1920x1080px)</label>
<div class="col-sm-10">
<input type="file" name="cover" placeholder="Uma imagem de capa"
class="form-control" id="j_img_preview"/>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-sm-2 control-label">Título*</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title" value="<?= $cases->title; ?>">
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-sm-2 control-label">Subtítulo*</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="subtitle"
value="<?= $cases->subtitle; ?>">
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Desafio de negócio*</label>
<textarea name="content1"
class="form-control mce"><?= $cases->content1; ?></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Inspiração natural *</label>
<textarea name="content2"
class="form-control mce"><?= $cases->content2; ?></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Solução*</label>
<textarea name="content3"
class="form-control mce"><?= $cases->content3; ?></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Resultado*</label>
<textarea name="content4"
class="form-control mce"><?= $cases->content4; ?></textarea>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
</div>
<div class="form-group row">
<div class="col-6">
<label class="control-label">Data de publicação:</label>
<input class="mask-datetime form-control" type="text" name="post_at"
value="<?= date_fmt($cases->post_at, "d/m/Y H:i"); ?>"
required/>
<!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
</div>
<div class="col-6">
<label class="control-label">Cliente/Parceiro:</label>
<select name="brand_id" class="form-control" required>
<?php
foreach ($brands as $brand):
$brandId = $cases->brand_id;
$select = function ($value) use ($brandId) {
return ($brandId == $value ? "selected" : "");
};
?>
<option <?= $select($brand->id); ?>
value="<?= $brand->id; ?>"><?= $brand->title; ?></option>
<?php
endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-2 control-label">Tipo de Case</label>
<div class="col-10">
<div class="custom-control custom-radio mb-3">
<input type="radio" id="customRadio1" name="status" class="custom-control-input"
value="1" <?= $cases->status == 1 ? "checked" : "" ?>>
<label class="custom-control-label" for="customRadio1">Case Iandé</label>
</div>
<div class="custom-control custom-radio mb-3">
<input type="radio" id="customRadio2" name="status" value="2"
class="custom-control-input" <?= $cases->status == 2 ? "checked" : "" ?> >
<label class="custom-control-label" for="customRadio2">Case de Mercado</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-12">
<label class="control-label">Galeria</label>
<input type="file" name="gallery[]" placeholder="Uma imagem de capa"
class="form-control" multiple id="gallery-upload"/>
<span class="help-block">Envie até 10 imagens por vez para não sobrecarregar o sistema</span>
</div>
</div>
<button class="btn btn-primary" type="submit">Publicar</button>
<a class="btn btn-danger" href="<?= url("/admin/cases/home"); ?>">Cancelar</a>
</form>
</div>
</section>
</div>
<div class="col-lg-3">
<section class="card">
<header class="card-header infinity-bg white-text text-center">
Imagem de capa
</header>
<img class="radius img-open" style="width: 100%;" src="<?= image($cases->cover, 400); ?>"
id="image-preview"/>
</section>
<?php
if ($gallery): ?>
<section class="card">
<header class="card-header infinity-bg white-text text-center">
Galeria de Imagens
</header>
<div class="card-body">
<ul class="grid cs-style-8 j-deleta">
<?php
foreach ($gallery as $g) : ?>
<li data-delete="<?= $g->id ?>">
<figure>
<img src="<?= image($g->gallery, 500, 500) ?>" alt="img04">
<figcaption>
<a class="bg-infinity" rel="group" href="" id="delete-gallery"
data-id="<?= $g->id ?>"
data-url="<?= url("/admin/removeimagegallery") ?>">
<i class="fa fa-trash-o"></i></a>
</figcaption>
</figure>
</li>
<?php
endforeach; ?>
</ul>
</div>
</section>
</div>
<?php
endif; ?>
</div>
</div>
<?php
endif; ?>
</section>
<?php
$this->start("scripts") ?>
<script src="<?= url("admin-assets/js/toucheffects.js") ?>"></script>
<script src="<?= url("admin-assets/js/modernizr.custom.js") ?>"></script>
<?php
$this->end(); ?>