Promociones
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreatePromotionProjects extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change(): void
|
||||
{
|
||||
$this->table('promotion_tables')
|
||||
->addColumn('promotion_id', 'integer', ['signed' => false, 'null' => false])
|
||||
->addColumn('project_id', 'integer', ['signed' => false, 'null' => false])
|
||||
->addForeignKey('promotion_id', 'promotions', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||
->addForeignKey('project_id', 'proyecto', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||
->create();
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreatePromotionContractUnits extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change(): void
|
||||
{
|
||||
$this->table('promotion_contract_units')
|
||||
->addColumn('promotion_id', 'integer', ['signed' => false, 'null' => false])
|
||||
->addColumn('contract_id', 'integer', ['signed' => false, 'null' => false])
|
||||
->addColumn('unit_id', 'integer', ['signed' => false, 'null' => false])
|
||||
->addForeignKey('promotion_id', 'promotions', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||
->addForeignKey('contract_id', 'broker_contracts', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||
->addForeignKey('unit_id', 'unidad', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||
->create();
|
||||
}
|
||||
}
|
@ -4,3 +4,6 @@ use Incoviba\Controller\Ventas\Promotions;
|
||||
$app->group('/promotions', function($app) {
|
||||
$app->get('[/]', Promotions::class);
|
||||
});
|
||||
$app->group('/promotion/{promotion_id}', function($app) {
|
||||
$app->get('[/]', [Promotions::class, 'show']);
|
||||
});
|
||||
|
@ -1,9 +1,21 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_title')
|
||||
@hasSection('promotions_title')
|
||||
Promoción - @yield('promotions_title')
|
||||
@else
|
||||
Promociones
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@section('page_content')
|
||||
<div class="ui container">
|
||||
<h2 class="ui header">
|
||||
Promociones
|
||||
@hasSection('promotions_header')
|
||||
Promoción - @yield('promotions_header')
|
||||
@else
|
||||
Promociones
|
||||
@endif
|
||||
</h2>
|
||||
@yield('promotions_content')
|
||||
</div>
|
||||
|
84
app/resources/views/ventas/promotions/show.blade.php
Normal file
84
app/resources/views/ventas/promotions/show.blade.php
Normal file
@ -0,0 +1,84 @@
|
||||
@extends('ventas.promotions.base')
|
||||
|
||||
@section('promotions_title')
|
||||
{{ $promotion->description }}
|
||||
@endsection
|
||||
|
||||
@section('promotions_header')
|
||||
{{ $promotion->description }}
|
||||
@endsection
|
||||
|
||||
@section('promotions_content')
|
||||
<div class="ui card">
|
||||
<div class="content">
|
||||
<div class="description">
|
||||
<p>
|
||||
{{ ucwords($promotion->type->name()) }} {{ ($promotion->type === Incoviba\Model\Venta\Promotion\Type::FIXED) ? $format->ufs($promotion->amount) : $format->percent($promotion->amount, 2, true) }}
|
||||
</p>
|
||||
<p>
|
||||
{{ $promotion->startDate->format('d-m-Y') }} -> {!! $promotion->endDate?->format('d-m-Y') ?? '∞' !!}
|
||||
</p>
|
||||
<p>Válido hasta: {!! $promotion->validUntil?->format('d-m-Y') ?? '∞' !!}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="ui table" id="contracts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Proyecto</th>
|
||||
<th>Operador</th>
|
||||
<th class="center aligned" colspan="2">Unidad</th>
|
||||
<th class="right aligned">
|
||||
<button class="ui tertiary green icon button" id="add_button">
|
||||
<i class="plus icon"></i>
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"></th>
|
||||
<th>Tipo</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (count($promotion->projects()) > 0)
|
||||
@foreach ($promotion->projects() as $project)
|
||||
<tr>
|
||||
<td>{{ $project->descripcion }}</td>
|
||||
<td>Todos los Operadores</td>
|
||||
<td colspan="2">Todas las Unidades</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@if (count($promotion->contracts()) > 0)
|
||||
@foreach($promotion->contracts() as $contract)
|
||||
<tr>
|
||||
<td>{{ $contract->project->descripcion }}</td>
|
||||
<td>{{ $contract->broker->name }}</td>
|
||||
<td colspan="2">Todas las Unidades</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@if (count($promotion->units()) > 0)
|
||||
@foreach($promotion->units() as $unit)
|
||||
<tr>
|
||||
<td>{{ $unit->project->descripcion }}</td>
|
||||
<td>Todos los Operadores</td>
|
||||
<td>{{ $unit->proyectoTipoUnidad->tipoUnidad->descripcion }}</td>
|
||||
<td>{{ $unit->descripcion }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@if (count($promotion->contractUnits()) > 0)
|
||||
@foreach($promotion->contractUnits() as $contractUnit)
|
||||
<tr>
|
||||
<td>{{ $contractUnit->contract->project->descripcion }}</td>
|
||||
<td>{{ $contractUnit->contract->broker->name }}</td>
|
||||
<td>{{ $contractUnit->unidad->proyectoTipoUnidad->tipoUnidad->descripcion }}</td>
|
||||
<td>{{ $contractUnit->unidad->descripcion }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
@endsection
|
@ -0,0 +1,2 @@
|
||||
<div class="ui modal" id="add_connection_modal">
|
||||
</div>
|
Reference in New Issue
Block a user