Add payment methods to hub entity and form. #554
This commit is contained in:
parent
01cdd7ef03
commit
12798e00be
3 changed files with 49 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ use App\Service\RisingTideGateway;
|
||||||
use App\Service\HubSelector;
|
use App\Service\HubSelector;
|
||||||
|
|
||||||
use App\Ramcar\HubCriteria;
|
use App\Ramcar\HubCriteria;
|
||||||
|
use App\Ramcar\ModeOfPayment;
|
||||||
|
|
||||||
class HubController extends Controller
|
class HubController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -131,6 +132,7 @@ class HubController extends Controller
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['obj'] = new Hub();
|
$params['obj'] = new Hub();
|
||||||
$params['mode'] = 'create';
|
$params['mode'] = 'create';
|
||||||
|
$params['payment_methods'] = ModeOfPayment::getCollection();
|
||||||
|
|
||||||
// response
|
// response
|
||||||
return $this->render('hub/form.html.twig', $params);
|
return $this->render('hub/form.html.twig', $params);
|
||||||
|
|
@ -238,6 +240,7 @@ class HubController extends Controller
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['obj'] = $obj;
|
$params['obj'] = $obj;
|
||||||
$params['mode'] = 'update';
|
$params['mode'] = 'update';
|
||||||
|
$params['payment_methods'] = ModeOfPayment::getCollection();
|
||||||
|
|
||||||
// response
|
// response
|
||||||
return $this->render('hub/form.html.twig', $params);
|
return $this->render('hub/form.html.twig', $params);
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,12 @@ class Hub
|
||||||
*/
|
*/
|
||||||
protected $notif_number;
|
protected $notif_number;
|
||||||
|
|
||||||
|
// payment methods
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="array", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $payment_methods;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->time_open = new DateTime();
|
$this->time_open = new DateTime();
|
||||||
|
|
@ -83,6 +89,7 @@ class Hub
|
||||||
$this->status_open = true;
|
$this->status_open = true;
|
||||||
$this->flag_hub_view = false;
|
$this->flag_hub_view = false;
|
||||||
$this->notif_number = '';
|
$this->notif_number = '';
|
||||||
|
$this->payment_methods = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRiders()
|
public function getRiders()
|
||||||
|
|
@ -203,4 +210,27 @@ class Hub
|
||||||
return $this->notif_number;
|
return $this->notif_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPaymentMethods()
|
||||||
|
{
|
||||||
|
return $this->payment_methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPaymentMethods(array $payment_methods)
|
||||||
|
{
|
||||||
|
$this->payment_methods = new ArrayCollection();
|
||||||
|
|
||||||
|
foreach ($payment_methods as $payment_method)
|
||||||
|
{
|
||||||
|
$this->payment_methods->add($payment_method);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearPaymentMethods()
|
||||||
|
{
|
||||||
|
$this->payment_methods = new ArrayCollection();
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,22 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group m-form__group row no-border">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label data-field="payment_method">Payment Methods</label>
|
||||||
|
<div class="m-checkbox-list">
|
||||||
|
{% for payment_method in payment_methods %}
|
||||||
|
<label class="m-checkbox">
|
||||||
|
<input type="checkbox" name="payment_methods[]" value="{{ payment_method }}"{{ payment_method in obj.getPaymentMethods ? ' checked' : '' }}>
|
||||||
|
{{ payment_method }}
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="form-control-feedback hide" data-field="payment_methods"></div>
|
||||||
|
<span class="m-form__help">Check all payment methods that apply</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group m-form__group row">
|
<div class="form-group m-form__group row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<label>
|
<label>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue