Admin producto y mirar mapa
This commit is contained in:
@ -5,6 +5,7 @@ use Psr\Container\ContainerInterface as Container;
|
|||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Slim\Views\Blade as View;
|
use Slim\Views\Blade as View;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class Productos {
|
class Productos {
|
||||||
public function __invoke(Request $request, Response $response, View $view, Container $container): Response {
|
public function __invoke(Request $request, Response $response, View $view, Container $container): Response {
|
||||||
@ -60,6 +61,66 @@ class Productos {
|
|||||||
}
|
}
|
||||||
public function do_edit(Request $request, Response $response, Container $container, $producto): Response {
|
public function do_edit(Request $request, Response $response, Container $container, $producto): Response {
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'productos.json'
|
||||||
|
]);
|
||||||
|
$id = $producto;
|
||||||
|
$productos = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$producto = $productos[$producto];
|
||||||
|
$changed = false;
|
||||||
|
|
||||||
|
$fields = ['nombre', 'segmento', 'direccion', 'comuna', 'ciudad', 'bono', 'rentabilidad', 'estado',
|
||||||
|
'cuota', 'unidades', 'modelos', 'descripcion', 'entrega'];
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
if (!isset($producto->$field) or $post[$field] != $producto->$field) {
|
||||||
|
$producto->$field = $post[$field];
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$valor = number_format($post['valor'], 0, ',', '.');
|
||||||
|
if (!isset($producto->valor) or $producto->valor != $valor) {
|
||||||
|
$producto->valor = $valor;
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
$tamaño = $post['tamaño_min'] . ' - ' . $post['tamaño_max'] . ' m²';
|
||||||
|
if (!isset($producto->tamaño) or $producto->tamaño != $tamaño) {
|
||||||
|
$producto->tamaño = $tamaño;
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status1 = false;
|
||||||
|
if ($changed) {
|
||||||
|
$productos[$id] = $producto;
|
||||||
|
$status1 = (file_put_contents($filename, json_encode($productos, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES)) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'destacados.json'
|
||||||
|
]);
|
||||||
|
$destacados = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$changed = false;
|
||||||
|
if (isset($post['destacado']) and $post['destacado'] == 'on') {
|
||||||
|
if (array_search($id, $destacados) === false) {
|
||||||
|
$destacados []= $id;
|
||||||
|
sort($destacados);
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (($i = array_search($id, $destacados)) !== false) {
|
||||||
|
unset($destacados[$i]);
|
||||||
|
$destacados = array_values($destacados);
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$status2 = false;
|
||||||
|
if ($changed) {
|
||||||
|
$status2 = (file_put_contents($filename, json_encode($destacados)) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response
|
||||||
|
->withHeader('Location', implode('/', [$container->get('urls')->admin, 'productos']));
|
||||||
}
|
}
|
||||||
public function add(Request $request, Response $response, View $view, Container $container): Response {
|
public function add(Request $request, Response $response, View $view, Container $container): Response {
|
||||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
@ -71,17 +132,172 @@ class Productos {
|
|||||||
}
|
}
|
||||||
public function do_add(Request $request, Response $response, Container $container): Response {
|
public function do_add(Request $request, Response $response, Container $container): Response {
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
|
||||||
|
$producto = (object) [];
|
||||||
|
$fields = ['nombre', 'segmento', 'direccion', 'comuna', 'ciudad', 'bono', 'rentabilidad', 'estado',
|
||||||
|
'cuota', 'unidades', 'modelos', 'descripcion', 'entrega'];
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
$producto->$field = $post[$field];
|
||||||
|
}
|
||||||
|
$valor = number_format($post['valor'], 0, ',', '.');
|
||||||
|
$producto->valor = $valor;
|
||||||
|
$tamaño = $post['tamaño_min'] . ' - ' . $post['tamaño_max'] . ' m²';
|
||||||
|
$producto->tamaño = $tamaño;
|
||||||
|
|
||||||
|
$f = Carbon::today();
|
||||||
|
$producto->publicacion = implode(' ', [
|
||||||
|
$f->day,
|
||||||
|
'de',
|
||||||
|
ucfirst($f->locale('es')->isoFormat('MMMM')) . ',',
|
||||||
|
$f->year
|
||||||
|
]);
|
||||||
|
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'productos.json'
|
||||||
|
]);
|
||||||
|
$productos = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$productos []= $producto;
|
||||||
|
file_put_contents($filename, json_encode($productos, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES));
|
||||||
|
|
||||||
|
if (isset($post['destacado']) and $post['destacado'] == 'on') {
|
||||||
|
$id = count($productos) - 1;
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'destacados.json'
|
||||||
|
]);
|
||||||
|
$destacados = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$destacados []= $id;
|
||||||
|
sort($destacados);
|
||||||
|
file_put_contents($filename, json_encode($destacados));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response
|
||||||
|
->withHeader('Location', implode('/', [$container->get('urls')->admin, 'productos']));
|
||||||
|
}
|
||||||
|
public function delete(Request $request, Response $response, Container $container): Response {
|
||||||
|
$post = $request->getParsedBody();
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'productos.json'
|
||||||
|
]);
|
||||||
|
$id = $post['id'];
|
||||||
|
$productos = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$producto = $productos[$id];
|
||||||
|
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.public'),
|
||||||
|
'assets',
|
||||||
|
'images',
|
||||||
|
mb_strtolower($producto->nombre)
|
||||||
|
]);
|
||||||
|
unset($productos[$id]);
|
||||||
|
$status = false;
|
||||||
|
$status |= (file_put_contents($filename, json_encode($productos, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES)) !== false);
|
||||||
|
if (file_exists($folder)) {
|
||||||
|
$status |= rmdir($folder);
|
||||||
|
}
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'destacados.json'
|
||||||
|
]);
|
||||||
|
$destacados = json_decode(trim(file_get_contents($filename)));
|
||||||
|
if (($i = array_search($id, $destacados)) !== false) {
|
||||||
|
unset($destacados[$i]);
|
||||||
|
$destacados = array_values($destacados);
|
||||||
|
$status |= (file_put_contents($filename, json_encode($destacados)) !== false);
|
||||||
|
}
|
||||||
|
$output = [
|
||||||
|
'information' => $post,
|
||||||
|
'estado' => $status
|
||||||
|
];
|
||||||
|
$response->getBody()->write(json_encode($output));
|
||||||
|
return $response
|
||||||
|
->withHeader('Content-Type', 'application/json')
|
||||||
|
->withStatus(201);
|
||||||
}
|
}
|
||||||
public function add_image(Request $request, Response $response, Container $container, $producto): Response {
|
public function add_image(Request $request, Response $response, Container $container, $producto): Response {
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
$files = $request->getUploadedFiles();
|
||||||
|
$file = $files['imagen'];
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'productos.json'
|
||||||
|
]);
|
||||||
|
$id = $producto;
|
||||||
|
$productos = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$producto = $productos[$producto];
|
||||||
|
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.public'),
|
||||||
|
'assets',
|
||||||
|
'images',
|
||||||
|
mb_strtolower($producto->nombre)
|
||||||
|
]);
|
||||||
|
if (!file_exists($folder)) {
|
||||||
|
mkdir($folder);
|
||||||
|
}
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$folder,
|
||||||
|
$file->getClientFilename()
|
||||||
|
]);
|
||||||
|
$file->moveTo($filename);
|
||||||
|
|
||||||
|
$output = [
|
||||||
|
'informacion' => $id,
|
||||||
|
'estado' => file_exists($filename)
|
||||||
|
];
|
||||||
|
$response->getBody()->write(json_encode($output));
|
||||||
|
return $response
|
||||||
|
->withHeader('Content-Type', 'application/json')
|
||||||
|
->withStatus(201);
|
||||||
}
|
}
|
||||||
public function set_video(Request $request, Response $response, Container $container, $producto): Response {
|
public function set_video(Request $request, Response $response, Container $container, $producto): Response {
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
$files = $request->getUploadedFiles();
|
||||||
|
die();
|
||||||
|
$file = $files['video'];
|
||||||
|
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.public'),
|
||||||
|
'assets',
|
||||||
|
'images',
|
||||||
|
mb_strtolower($producto->nombre)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
public function delete_image(Request $request, Response $response, Container $container, $producto): Response {
|
public function delete_image(Request $request, Response $response, Container $container, $producto): Response {
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.data'),
|
||||||
|
'productos.json'
|
||||||
|
]);
|
||||||
|
$id = $producto;
|
||||||
|
$productos = json_decode(trim(file_get_contents($filename)));
|
||||||
|
$producto = $productos[$producto];
|
||||||
|
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.public'),
|
||||||
|
'assets',
|
||||||
|
'images',
|
||||||
|
mb_strtolower($producto->nombre)
|
||||||
|
]);
|
||||||
|
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$folder,
|
||||||
|
$post['imagen']
|
||||||
|
]);
|
||||||
|
$status = unlink($filename);
|
||||||
|
|
||||||
|
$output = [
|
||||||
|
'estado' => $status
|
||||||
|
];
|
||||||
|
$response->getBody()->write(json_encode($output));
|
||||||
|
return $response
|
||||||
|
->withHeader('Content-Type', 'application/json')
|
||||||
|
->withStatus(201);
|
||||||
}
|
}
|
||||||
public function delete_video(Request $request, Response $response, Container $container, $producto): Response {
|
public function delete_video(Request $request, Response $response, Container $container, $producto): Response {
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.public'),
|
||||||
|
'assets',
|
||||||
|
'images',
|
||||||
|
mb_strtolower($producto->nombre)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,13 +40,15 @@ class Productos {
|
|||||||
'images',
|
'images',
|
||||||
mb_strtolower($producto->nombre)
|
mb_strtolower($producto->nombre)
|
||||||
]);
|
]);
|
||||||
$files = new \DirectoryIterator($folder);
|
|
||||||
$producto->images = [];
|
$producto->images = [];
|
||||||
foreach ($files as $file) {
|
if (file_exists($folder)) {
|
||||||
if ($file->isDir()) {
|
$files = new \DirectoryIterator($folder);
|
||||||
continue;
|
foreach ($files as $file) {
|
||||||
|
if ($file->isDir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$producto->images []= $file->getFilename();
|
||||||
}
|
}
|
||||||
$producto->images []= $file->getFilename();
|
|
||||||
}
|
}
|
||||||
return $view->render($response, 'productos.show', compact('producto'));
|
return $view->render($response, 'productos.show', compact('producto'));
|
||||||
}
|
}
|
||||||
@ -112,6 +114,23 @@ class Productos {
|
|||||||
$producto = $productos[$producto];
|
$producto = $productos[$producto];
|
||||||
$producto->destacado = $destacado;
|
$producto->destacado = $destacado;
|
||||||
$producto->id = $id;
|
$producto->id = $id;
|
||||||
|
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||||
|
$container->get('folders.public'),
|
||||||
|
'assets',
|
||||||
|
'images',
|
||||||
|
mb_strtolower($producto->nombre)
|
||||||
|
]);
|
||||||
|
$producto->imagen = 'default.jpg';
|
||||||
|
if (file_exists($folder)) {
|
||||||
|
$files = new \DirectoryIterator($folder);
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if ($file->isDir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$producto->imagen = implode('/', [mb_strtolower($producto->nombre), $file->getFilename()]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return $view->render($response, 'productos.ficha', compact('producto'));
|
return $view->render($response, 'productos.ficha', compact('producto'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 992 KiB After Width: | Height: | Size: 992 KiB |
@ -6,6 +6,7 @@ $app->group('/productos', function($app) {
|
|||||||
$app->get('[/]', [Productos::class, 'add']);
|
$app->get('[/]', [Productos::class, 'add']);
|
||||||
$app->post('[/]', [Productos::class, 'do_add']);
|
$app->post('[/]', [Productos::class, 'do_add']);
|
||||||
});
|
});
|
||||||
|
$app->post('/delete', [Productos::class, 'delete']);
|
||||||
$app->get('[/]', Productos::class);
|
$app->get('[/]', Productos::class);
|
||||||
});
|
});
|
||||||
$app->group('/producto/{producto}', function($app) {
|
$app->group('/producto/{producto}', function($app) {
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
<label>Comuna</label>
|
<label>Comuna</label>
|
||||||
<input type="text" name="comuna" value="{{$producto->comuna ?? ''}}" />
|
<input type="text" name="comuna" value="{{$producto->comuna ?? ''}}" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label>Ciudad</label>
|
||||||
|
<input type="text" name="ciudad" value="{{$producto->ciudad ?? ''}}" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
@ -101,7 +105,7 @@
|
|||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Tamaño Mínimo</label>
|
<label>Tamaño Mínimo</label>
|
||||||
<input type="text" name="tamaño" value="{{(isset($producto->tamaño)) ? explode(' - ', rtrim($producto->tamaño, ' m²'))[0] : ''}}" />
|
<input type="text" name="tamaño_min" value="{{(isset($producto->tamaño)) ? explode(' - ', rtrim($producto->tamaño, ' m²'))[0] : ''}}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Tamaño Máximo</label>
|
<label>Tamaño Máximo</label>
|
||||||
@ -122,6 +126,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="imagenes" class="ui list"></div>
|
<div id="imagenes" class="ui list"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Video</label>
|
<label>Video</label>
|
||||||
@ -138,6 +144,7 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
*/?>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<button class="ui button">GUARDAR</button>
|
<button class="ui button">GUARDAR</button>
|
||||||
@ -192,9 +199,13 @@
|
|||||||
text: {
|
text: {
|
||||||
months: months.long,
|
months: months.long,
|
||||||
monthsShort: months.short
|
monthsShort: months.short
|
||||||
|
},
|
||||||
|
formatInput: false,
|
||||||
|
onChange: function(a, b) {
|
||||||
|
$(this).find('input').val(('0' + (a.getMonth() + 1)).slice(-2) + '/' + a.getFullYear())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var entrega = new Date('20{{implode('-', array_reverse(explode('/', $producto->entrega)))}}-01T01:00')
|
var entrega = new Date('{{str_pad(implode('-', array_reverse(explode('/', $producto->entrega))), 7, '20', STR_PAD_LEFT)}}-01T01:00')
|
||||||
$('.calendar').calendar('set date', entrega)
|
$('.calendar').calendar('set date', entrega)
|
||||||
$('.checkbox').checkbox()
|
$('.checkbox').checkbox()
|
||||||
@if ($producto->destacado)
|
@if ($producto->destacado)
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
<label>Comuna</label>
|
<label>Comuna</label>
|
||||||
<input type="text" name="comuna" />
|
<input type="text" name="comuna" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label>Ciudad</label>
|
||||||
|
<input type="text" name="ciudad" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
@ -101,7 +105,7 @@
|
|||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Tamaño Mínimo</label>
|
<label>Tamaño Mínimo</label>
|
||||||
<input type="text" name="tamaño" />
|
<input type="text" name="tamaño_min" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Tamaño Máximo</label>
|
<label>Tamaño Máximo</label>
|
||||||
@ -150,6 +154,10 @@
|
|||||||
text: {
|
text: {
|
||||||
months: months.long,
|
months: months.long,
|
||||||
monthsShort: months.short
|
monthsShort: months.short
|
||||||
|
},
|
||||||
|
formatInput: false,
|
||||||
|
onChange: function(a) {
|
||||||
|
$(this).find('input').val(('0' + (a.getMonth() + 1)).slice(-2) + '/' + a.getFullYear())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$('.checkbox').checkbox()
|
$('.checkbox').checkbox()
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<div class="ui top attached tabular menu">
|
<div class="ui top attached tabular menu">
|
||||||
<a class="active item" data-tab="informacion">Información</a>
|
<a class="active item" data-tab="informacion">Información</a>
|
||||||
<a class="item" data-tab="mapa">Ver Mapa</a>
|
<a class="item" data-tab="mapa">Ver Mapa</a>
|
||||||
<a class="item" data-tab="video">Video</a>
|
|
||||||
<a class="item" data-tab="estado">Estado del producto</a>
|
<a class="item" data-tab="estado">Estado del producto</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui bottom attached basic segment active tab" data-tab="informacion">
|
<div class="ui bottom attached basic segment active tab" data-tab="informacion">
|
||||||
@ -14,7 +13,7 @@
|
|||||||
Precio:
|
Precio:
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->valor}} UF
|
{{$producto->valor ?? ''}} UF
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -22,7 +21,7 @@
|
|||||||
Estado:
|
Estado:
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->estado}}
|
{{$producto->estado ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -30,7 +29,7 @@
|
|||||||
Tipo:
|
Tipo:
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->segmento}}
|
{{$producto->segmento ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -38,7 +37,7 @@
|
|||||||
Ubicación:
|
Ubicación:
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->comuna}}, {{$producto->ciudad}}
|
{{$producto->comuna ?? ''}}, {{$producto->ciudad ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -46,7 +45,7 @@
|
|||||||
Unidades:
|
Unidades:
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->unidades}}
|
{{$producto->unidades ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -54,7 +53,7 @@
|
|||||||
Modelos:
|
Modelos:
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->modelos}}
|
{{$producto->modelos ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -62,25 +61,21 @@
|
|||||||
Tamaño
|
Tamaño
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
{{$producto->tamaño}}
|
{{$producto->tamaño ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="twelve wide column">
|
<div class="twelve wide column">
|
||||||
{{$producto->descripcion}}
|
{{$producto->descripcion ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui bottom attached basic segment tab" data-tab="mapa">
|
<div class="ui bottom attached basic segment tab" data-tab="mapa">
|
||||||
<div class="ui fluid placeholder">
|
<div class="ui embed" id="map" data-source="Google Maps"
|
||||||
<div class="image"></div>
|
data-url="https://maps.google.com/maps?hl=es&amp;q={{(isset($producto->direccion)) ? str_replace(' ', '%20', implode(', ', [
|
||||||
</div>
|
$producto->direccion, $producto->comuna
|
||||||
</div>
|
])) : 'Santiago,%20Chile'}}&amp;ie=UTF8&amp;z=11&amp;iwloc=B&amp;output=embed"></div>
|
||||||
<div class="ui bottom attached basic segment tab" data-tab="video">
|
|
||||||
<div class="ui fluid placeholder">
|
|
||||||
<div class="image"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui bottom attached basic segment tab" data-tab="estado">
|
<div class="ui bottom attached basic segment tab" data-tab="estado">
|
||||||
<div class="ui fluid placeholder">
|
<div class="ui fluid placeholder">
|
||||||
@ -103,6 +98,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
$('#datos').find('.tabular .item').tab()
|
$('#datos').find('.tabular .item').tab()
|
||||||
|
$('#map').embed()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
<div id="galeria">
|
<div id="galeria">
|
||||||
<div class="ui image" data-id="0">
|
@if (count($producto->images))
|
||||||
<img src="{{$urls->images}}/{{mb_strtolower($producto->nombre)}}/{{$producto->imagen}}" />
|
<div class="ui image" data-id="0">
|
||||||
</div>
|
<img src="{{$urls->images}}/{{mb_strtolower($producto->nombre)}}/{{$producto->imagen}}" />
|
||||||
<div class="ui grid" id="thumbnails">
|
</div>
|
||||||
@foreach ($producto->images as $i => $image)
|
<div class="ui grid" id="thumbnails">
|
||||||
@if ($i == 0)
|
@foreach ($producto->images as $i => $image)
|
||||||
@continue
|
@if ($i == 0)
|
||||||
@endif
|
@continue
|
||||||
<div class="three wide column">
|
@endif
|
||||||
<div class="ui image" data-id="{{$i}}">
|
<div class="three wide column">
|
||||||
<img src="{{$urls->images}}/{{mb_strtolower($producto->nombre)}}/{{$image}}" />
|
<div class="ui image" data-id="{{$i}}">
|
||||||
|
<img src="{{$urls->images}}/{{mb_strtolower($producto->nombre)}}/{{$image}}" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endforeach
|
||||||
@endforeach
|
</div>
|
||||||
</div>
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
{{$producto->nombre}}
|
{{$producto->nombre}}
|
||||||
</span>
|
</span>
|
||||||
<span class="direccion">
|
<span class="direccion">
|
||||||
{{$producto->direccion}}, {{$producto->comuna}}, {{$producto->ciudad}}
|
{{$producto->direccion ?? ''}}, {{$producto->comuna ?? ''}}, {{$producto->ciudad ?? ''}}
|
||||||
</span>
|
</span>
|
||||||
<div class="publicado">
|
<div class="publicado">
|
||||||
Publicado el {{$producto->publicacion}}
|
Publicado el {{$producto->publicacion ?? ''}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@include('productos.producto.galeria')
|
@include('productos.producto.galeria')
|
||||||
|
Reference in New Issue
Block a user