File: //home/artinside/fhs.artinside.com.br/themes/adminBackup/widgets/product/category.php
<?php $this->layout("_admin"); ?>
<section class="wrapper">
<!-- page start-->
<?php if (!$category): ?>
<div class="row">
<div class="col-12 text-center my-4 text-sm-center">
<h3> Nova Categoria</h3>
<p>Crie um nova categoria </p>
</div>
<div class="col-lg-9">
<section class="card">
<header class="card-header infinity-bg white-text">
Cadastrar Categoria
</header>
<div class="card-body">
<form class="form-horizontal tasi-form" method="post" action="<?= url("admin/product/category"); ?>">
<input type="hidden" name="action" value="create"/>
<div class="form-group row" hidden>
<label class="col-sm-2 col-sm-2 control-label">Capa</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">Sessão</label>
<div class="col-sm-10">
<select name="session" class="form-control" >
<option disabled>Selecione um tipo de categoria</option>
<option value="0">>> Categoria Principal</option>
<?php foreach ($subSession as $session): ?>
<option
value="<?= $session->id; ?>"><?= $session->title; ?></option>
<?php endforeach; ?>
</select>
<span class="help-block">Selecione se esta é uma categoria principal ou selecione sua subcategoria</span>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-sm-2 control-label">Conteúdo</label>
<div class="col-sm-10">
<textarea name="description" class="form-control"></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>
<button class="btn btn-primary" type="submit">Enviar</button>
<a class="btn btn-danger" href="<?= url("/admin/product/categories"); ?>">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($category->cover, 400); ?>" id="image-preview"/>
</section>
</div>
</div>
<?php else: ?>
<div class="row">
<div class="col-12 text-center my-4 text-sm-center">
<h3> <?= $category->title; ?> </h3>
<p>Edição de categoria </p>
</div>
<div class="col-lg-9">
<section class="card">
<header class="card-header infinity-bg white-text text-center">
Edição de Categorias
</header>
<div class="card-body">
<form class="form-horizontal tasi-form" method="post" action="<?= url("/admin/product/category/{$category->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</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="<?= $category->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">Sessão</label>
<?php if ($category->session == 0): ?>
<div class="col-sm-10">
<input type="text" class="form-control" disabled value="Esta é uma categoria Principal">
<span class="help-block">Categorias principais não podem virar subcategorias</span>
<input type="hidden" name="session" value="0">
</div>
<?php else: ?>
<div class="col-sm-10">
<select name="session" class="form-control" required>
<option value="0">>> Categoria Principal</option>
<?php foreach ($subSession as $session):?>
<option <?= $category->session == $session->id ? "selected" : ""; ?>
value="<?= $session->id; ?>"><?= $session->title; ?></option>
<?php endforeach; ?>
</select>
<span class="help-block">Selecione se esta é uma categoria principal ou selecione sua subcategoria</span>
</div>
<?php endif; ?>
</div>
<div class="form-group row">
<label class="col-sm-2 col-sm-2 control-label">Conteúdo</label>
<div class="col-sm-10">
<textarea name="description" class="form-control"><?= $category->description; ?></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>
<button class="btn btn-primary" type="submit">Atualizar</button>
<a class="btn btn-danger" href="<?= url("/admin/product/categories"); ?>">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($category->cover, 400); ?>" id="image-preview"/>
</section>
</div>
</div>
<?php endif; ?>
<!-- page end-->
</section>