{% extends 'fos/base.html.twig' %}
{% block firstnav %}
{{ render(controller('App\\Parcels\\DefaultController::nav')) }}
{% endblock %}
{% block secondnav %}
<style>
.cash, .print, .payment .mpesa {
width: 220px;
border-radius: 30px;
}
.cash {
/*float: right;*/
}
.active, payment .focus{
background: white;
color: black;
}
.cash img {
height: 18px;
}
</style>
<!-- Second Nav -->
<nav class="navbar-second navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Brand -->
{% block current %}
<span class="navbar-brand" href="#"><i class="fa fa-gears"></i> NEW PARCEL
{% if user_station %}
FROM {{ user_station.station.stationName }}
{% endif %}
</span>
{% endblock %}
</div>
<div class="collapse navbar-collapse animated fadeIn" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav animated fadeIn">
{% block secondarylinkblock %}
<li class="active"><a href="{{ path('new-parcel') }}"><i class="fa fa-plus-circle"></i> Register Parcel</a></li>
<li class=""><a href="{{ path('my_daily_parcel_transactions') }}"><i class="fa fa-th-list"></i> Todays Transactions</a></li>
<li class=""><a href="{{ path('close_daily_account') }}"><i class="fa fa-window-close"></i> close & open Daily account</a></li>
{% endblock %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li class=""><a></a></li>
{#<li><p class="navbar-text"></p></li>#}
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
{% endblock %}
{% block main %}
<div class="row">
<div class="col">
{{ form_start(form, {'attr':{'id':'student_form'}}) }}
<fieldset>
<legend>Receiver</legend>
<div class="row">
<div class="col-lg-3 col-md-3">
<label for="receiver_name">Receiver Name</label>
{{ form_widget(form.receiverName,{'attr':{'class':'form-control','placeholder':'ie: George Muriuki Mukuria','autocomplete':'false' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.receiverName) }}
</div>
</div>
<div class="col-lg-3 col-md-3">
<label for="sender_name">Receiver Phone Number</label>
{{ form_widget(form.receiverPhoneNumber,{'attr':{'class':'form-control receiver_phone','placeholder':'ie: 0714 000 000','autocomplete':'false' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.receiverPhoneNumber) }}
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Sender</legend>
<div class="row">
<div class="col-lg-3 col-md-3">
<label for="sender_name">Sender Name</label>
{{ form_widget(form.senderName,{'attr':{'class':'form-control','placeholder':'ie: Kelvin Njiru Ngari','autocomplete':'false' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.senderName) }}
</div>
</div>
<div class="col-lg-3 col-md-3">
<label for="sender_phoneNumber">Sender Phone Number</label>
{{ form_widget(form.senderPhoneNumber,{'attr':{'class':'form-control sender_phone','placeholder':'ie 0734 000 000','autocomplete':'false' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.senderPhoneNumber) }}
</div>
</div>
<div class="col-lg-3 col-md-3">
<label for="sender_phoneNumber">Parcel Value</label>
{{ form_widget(form.parcelValue,{'attr':{'class':'form-control','placeholder':'ie 1000','autocomplete':'false' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.parcelValue) }}
</div>
</div>
<div class="col-lg-3 col-md-3">
<label for="sender_phoneNumber">Pin Number</label>
{{ form_widget(form.transaction.pinNumber,{'attr':{'class':'form-control pin_number','placeholder':'ie P015023523E','autocomplete':'false' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.transaction.pinNumber) }}
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Destination</legend>
<div class="row">
<div class="col-lg-3 col-md-3">
<label for="receiver_name">To </label>
{{ form_widget(form.toStation,{'attr':{'class':'form-control' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.toStation) }}
</div>
</div>
<div class="col-lg-2 col-md-2">
<label for="amount">Amount</label>
{{ form_widget(form.transaction.amount,{'attr':{'class':'form-control' }} ) }}
<div class="invalid-feedback">
{{ form_errors(form.transaction.amount) }}
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Parcel Unit</legend>
<div class="row">
<div class="col-lg-12 col-md-12">
{# store the prototype on the data-prototype attribute #}
<div class="parcels" id="parcel-fields-list"
data-prototype="{{ form_widget(form.parcels.vars.prototype.description,{'attr':{'class':'form-control', 'cols':'5', 'rows':'5'}})|e('html_attr')}}"
{#data-widget-tags="{{ '<div class="row" style="margin-bottom: 10px;"></div>'|e }}"#}>
{# iterate over each existing tag and render its only field: name #}
{% for parcel in form.parcels %}
<div class="col-lg-4 col-md-4" style="margin-bottom: 20px;">
<div class="col-lg-8 col-md-8">Parcel #{{ loop.index }}
{{ form_widget(parcel.description,{'attr':{'class':'form-control', 'cols':'5', 'rows':'5' }}) }}
</div>
<div class="col-lg-4 col-md-4">
<a href="#" class="btn btn-danger btn-sm remove-tag" style="margin-top: 80px;"><i class="fas fa-trash"></i></a>
</div>
</div>
{% endfor %}
</div>
{#<button type="button"#}
{#class="add-another-collection-widget"#}
{#data-list="#parcel-fields-list">Add parcel</button>#}
</div>
</div>
</fieldset>
<div class="invalid-feedback">
{{ form_errors(form) }}
</div>
<fieldset style="text-align: center;">
<legend>Complete</legend>
<button type="submit" id="save_button" class="btn btn-success cash" formnovalidate>Complete Registration <i class="fa fa-arrow-circle-o-right"></i></button>
</fieldset>
{{ form_end(form) }}
</div>
</div>
{% endblock %}
{% block javascript %}
<script type="text/javascript" src="{{ asset('fos/scripts/parcel_collection_form.js?1.0.1') }}"></script>
<script type="text/javascript" src="{{ asset('assets/plugins/jquery.mask.min.js') }}"></script>
<script >
$('.sender_phone').mask('0000 000 000');
$('.receiver_phone').mask('0000 000 000');
$('.pin_number').mask('A000000000A', {
'translation':{
A: { pattern: /[A-Z]/}
}
});
</script>
{% endblock %}