{% extends 'VGMWOBundle::layout.html.twig' %}

{% block stylesheets %}
    {{ parent() }}
    <link href="{{ asset('bundles/vgmwo/css/bootstrap-datetimepicker.css') }}" rel="stylesheet" media="screen">
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('bundles/vgmwo/js/bootstrap-datetimepicker.js') }}"></script>
    <script type="text/javascript">
        $('.datepicker').datetimepicker({
            language:  'fr',
            weekStart: 0,
            todayBtn:  1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });
    </script>
{% endblock %}
{% block jumbotron_content %}
    <div class="jumbotron" style="padding-top: 10px; padding-bottom: 5px;"  id="jumbotron">
        <div class="container-fluid">
            <div class="col-md-12 text-center" style="padding-left: 0px;">
                <H3 style="margin: 0px;"><strong>Update workers</strong></H3>
            </div>
        </div>
    </div>
{% endblock %}
{% block content %}
    <div class="container" style="min-height: 500px;">
        <div class="row">
            <div class="col-md-12 text-right">
                <div class="col-ms-2 pull-right">
                    <a href="{{ path('workers') }}">
                        <span class="glyphicon glyphicon-list"></span>
                        Main list
                    </a>
                </div>
            </div>
            {% form_theme edit_form _self %}
            <form id="edit_form" action="{{ path('workers_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}>
                <div class="form-group container-fluid">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="col-md-4" style="padding-left: 0px;">
                                <img src="{{ entity.picture.getFinalWebPath }}"  width="120px;" height="120px;">
                                {{ form_errors(edit_form.picture) }}
                                {{ form_widget(edit_form.picture.file) }}
                            </div>
                            <div class="col-md-8">
                                <label style="margin-bottom: 0px;">Birth date: </label>
                                {{ form_errors(edit_form.birth_date) }}
                                {{ form_widget(edit_form.birth_date, { 'attr': {
                                'type': 'date'
                                'accesskey': 'n',
                                'tabindex': 11,
                                'data-date': '',
                                'data-date-format': 'mm/dd/yyyy',
                                'data-link-field': 'birth_date_picker',
                                'data-link-format': 'mm/dd/yyyy',
                                'class': 'form-control for-desktop datepicker'} }) }}
                                <input type="hidden" id="birth_date_picker" value="" />
                            </div>
                            <div class="col-md-8">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Employee code: </label>
                                {{ form_errors(edit_form.worker_code) }}
                                {{ form_widget(edit_form.worker_code, { 'attr': {
                                'id': 'worker_code',
                                'accesskey' : 'n',
                                'class': 'form-control for-desktop',
                                'type': 'text'} }) }}
                            </div>
                            <!-- Name input -->
                            <div class="col-md-8">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Name: </label>
                                {{ form_errors(edit_form.name) }}
                                {{ form_widget(edit_form.name, { 'attr': {
                                'id': 'name_imput',
                                'accesskey' : 'n',
                                'tabindex' : 1,
                                'class': 'form-control for-desktop',
                                'type': 'text',
                                'placeholder': 'Employee Name'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Last name: </label>
                                {{ form_errors(edit_form.lastname) }}
                                {{ form_widget(edit_form.lastname, { 'attr': {
                                'id': 'lastname_imput',
                                'accesskey' : 'n',
                                'tabindex' : 2,
                                'class': 'form-control for-desktop',
                                'type': 'text',
                                'placeholder': 'Employee Last Name'} }) }}
                            </div>
                            <!-- Main phone input -->
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Personal phone number: </label>
                                {{ form_errors(edit_form.phone1) }}
                                {{ form_widget(edit_form.phone1, { 'attr': {
                                'accesskey' : 'p',
                                'tabindex' : 7,
                                'class': 'form-control for-desktop',
                                'type': 'text',
                                'placeholder': 'Main Phone Number'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Personal e-mail: </label>
                                {{ form_errors(edit_form.pemail) }}
                                {{ form_widget(edit_form.pemail, { 'attr': {
                                'accesskey' : 'e',
                                'tabindex' : 8,
                                'class': 'form-control for-desktop',
                                'type': 'email',
                                'placeholder': 'e-mail'} }) }}
                            </div>
                            <!-- Street input -->
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Street: </label>
                                {{ form_errors(edit_form.address) }}
                                {{ form_widget(edit_form.address, { 'attr': {
                                'accesskey' : 'a',
                                'tabindex' : 3,
                                'class': 'form-control for-desktop',
                                'placeholder': 'Street'} }) }}
                            </div>
                            <div class="col-sm-4">
                                <label style="margin-bottom: 0px; margin-top: 10px;">City: </label>
                                {{ form_errors(edit_form.city) }}
                                {{ form_widget(edit_form.city, { 'attr': {
                                'accesskey' : 't',
                                'tabindex' : 4,
                                'class': 'form-control for-desktop',
                                'placeholder': 'City'} }) }}
                            </div>
                            <div class="col-sm-4">
                                <label style="margin-bottom: 0px; margin-top: 10px;">State: </label>
                                {{ form_errors(edit_form.state) }}
                                {{ form_widget(edit_form.state, { 'attr': {
                                'accesskey' : 's',
                                'tabindex' : 5,
                                'class': 'form-control for-desktop',
                                'placeholder': 'State'} }) }}
                            </div>
                            <div class="col-sm-4">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Zip code: </label>
                                {{ form_errors(edit_form.zip_code) }}
                                {{ form_widget(edit_form.zip_code, { 'attr': {
                                'accesskey' : 'z',
                                'tabindex' : 6,
                                'class': 'form-control for-desktop',
                                'placeholder': 'Zip Code'} }) }}
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px;">Work phone number: </label>
                                {{ form_errors(edit_form.phone2) }}
                                {{ form_widget(edit_form.phone2, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 9,
                                'class': 'form-control for-desktop',
                                'placeholder': 'Work Phone Number'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Work e-mail: </label>
                                {{ form_errors(edit_form.wemail) }}
                                {{ form_widget(edit_form.wemail, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'class': 'form-control for-desktop',
                                'placeholder': 'Work E-mail'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Hire date: </label>
                                {{ form_errors(edit_form.hire_date) }}
                                {{ form_widget(edit_form.hire_date, { 'attr': {
                                'type': 'date'
                                'accesskey' : 'n',
                                'tabindex' : 11,
                                'data-date': '',
                                'data-date-format': 'mm/dd/yyyy',
                                'data-link-field': 'hire_date_picker',
                                'data-link-format': 'mm/dd/yyyy',
                                'class': 'form-control for-desktop datepicker'} }) }}
                                <input type="hidden" id="hire_date_picker" value="" />
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Department: </label>
                                {{ form_errors(edit_form.department) }}
                                {{ form_widget(edit_form.department, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'class': 'form-control for-desktop'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Standard payment: </label>
                                {{ form_errors(edit_form.standart_pay) }}
                                <div class="input-group">
                                    <div class="input-group-addon">$</div>
                                    {{ form_widget(edit_form.standart_pay, { 'attr': {
                                    'accesskey' : 'n',
                                    'tabindex' : 10,
                                    'class': 'form-control for-desktop',
                                    'placeholder': 'Standard Payment'} }) }}
                                </div>
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Payment schedule: </label>
                                {{ form_errors(edit_form.npayschedule) }}
                                {{ form_widget(edit_form.npayschedule, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'class': 'form-control for-desktop',
                                'placeholder': 'Payment Schedule'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Payment rate: </label>
                                <div class="input-group">
                                    <div class="input-group-addon">$</div>
                                    {{ form_errors(edit_form.pay_rate) }}
                                    {{ form_widget(edit_form.pay_rate, { 'attr': {
                                    'accesskey' : 'n',
                                    'tabindex' : 10,
                                    'class': 'form-control for-desktop',
                                    'placeholder': 'Payment Rate'} }) }}
                                </div>
                            </div>
                            <div class="col-md-3">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Full time: </label>
                                {{ form_errors(edit_form.full_time) }}
                                {{ form_widget(edit_form.full_time, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'style' : 'display: block;'} }) }}
                            </div>
                            <div class="col-md-3">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Supervisor: </label>
                                {{ form_errors(edit_form.supervisor) }}
                                {{ form_widget(edit_form.supervisor, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'style' : 'display: block;'} }) }}
                            </div>
                            <div class="col-md-3">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Payment by hour: </label>
                                {{ form_errors(edit_form.pay_by_hour) }}
                                {{ form_widget(edit_form.pay_by_hour, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'style' : 'display: block;'} }) }}
                            </div>
                            <div class="col-md-3">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Is active: </label>
                                {{ form_errors(edit_form.status_active) }}
                                {{ form_widget(edit_form.status_active, { 'attr': {
                                'accesskey' : 'n',
                                'tabindex' : 10,
                                'style' : 'display: block;'} }) }}
                            </div>
                            <div class="col-md-12">
                                <label style="margin-bottom: 0px; margin-top: 10px;">Termination date: </label>
                                {{ form_errors(edit_form.termination_date) }}
                                {{ form_widget(edit_form.termination_date, { 'attr': {
                                'type': 'date'
                                'accesskey' : 'n',
                                'tabindex' : 11,
                                'data-date': '',
                                'data-date-format': 'mm/dd/yyyy',
                                'data-link-field': 'termination_date_picker',
                                'data-link-format': 'mm/dd/yyyy',
                                'class': 'form-control for-desktop datepicker'} }) }}
                                <input type="hidden" id="termination_date_picker" value="" />
                            </div>
                        </div>
                    </div>
                </div>
                {{ form_rest(edit_form) }}
            </form>
            <div class="row container-fluid text-right">
                <div class="col-xs-1 pull-right">
                    <button form="edit_form" type="submit" class="btn btn-info btn-sm">Update</button>
                </div>
                <div class="col-xs-1 pull-right">
                    {{ form_start(delete_form) }}
                    {{ form_widget(delete_form.submit, {'attr': {
                    'class': 'btn btn-warning btn-sm' }}) }}
                    {{ form_rest(delete_form) }}
                    {{ form_end(delete_form) }}
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript">
        // Activates knockout.js
        //ko.applyBindings(baseViewModel, document.getElementById("menu-bar"));
    </script>
{% endblock %}