<div class="card panel-fcs-border shadow-sm">
    <div class="card-header">
        <span class="fcs-card-title h2">
            [% if $create %]
                [% $user->gettext('Kommerzielle Gerätedaten anlegen') %]
            [% else %]
                [% $user->gettext('Kommerzielle Gerätedaten bearbeiten') %]
            [% /if %]
        </span>
    </div>
    <div class="card-body">
        <form  action="index.php?module=assets&class=commercialdevdata&event=saveData" method="post" name="hm" id="hm" class="form-horizontal form-label-left">
            <input type="hidden" name="save" value="1">
            <input type="hidden" name="deviceid" value="[% $Device.deviceid %]">
            <input type="hidden" name="commercialdevdataid" value="[% $CDData.commercialdevdataid %]">
            <div class="card panel-info shadow-sm rounded">
                <div class="card-header">
                    <span class="fcs-card-title h3">[% $user->gettext('Kommerzielle Gerätedaten') %]</span>

                    <span class='pull-right'>
                        <a href="index.php?module=assets&class=commercialdevdata" class='btn btn-outline-secondary'>[% $user->gettext('Liste') %]</a>
                        <button class='btn btn-outline-secondary'>[% $user->gettext('Speichern') %]</button>
                    </span>
                </div>

                <div class="card-body">
                    <div class="card panel-info shadow-sm rounded">                  
                        <div class="card-body">
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('Gerätname')%]</label>
                                        <div class='col-sm-8'>
                                            <a href="index.php?module=assets&fromclass=commercialdevdata" class="btn btn-outline-secondary openInBigIFrameModal">[% $user->gettext('Gerät zuweisen') %]</a>
                                            [% if $Device.deviceid %]<span class="fa fa-hard-drive"></span>&nbsp;&nbsp;&nbsp;[%$Device.devicename%][% /if %]
                                        </div>
                                    </div>

                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('Hostname')%]</label>
                                        <div class='col-sm-8'>
                                            <input disabled="disabled" type='text' name='' class='form-control' value="[% $Device.hostname %]">
                                        </div>
                                    </div>
                                     <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('Vendor')%]</label>
                                        <div class='col-sm-8'>
                                            <select class="form-control" name="vendorid">
                                                <option value="0">[% $user->gettext('Bitte wählen Sie ein Vendor')%]</option>
                                                [% foreach from=$Vendors item=$Vendor %]
                                                    <option value="[% $Vendor.vendorid %]" [% if $Vendor.vendorid==$CDData.vendorid %]selected="selected"[% /if %]>[% $Vendor.vendornameshort%]</option>
                                                [% /foreach %]
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingvendor')%]</label>
                                        <div class='col-sm-8'>
                                            <select class="form-control" name="leasingvendorid">
                                                <option value="0">[% $user->gettext('Bitte wählen Sie ein leasingvendor')%]</option>
                                                [% foreach from=$Vendors item=$Vendor %]
                                                    <option value="[% $Vendor.vendorid %]" [% if $Vendor.vendorid==$CDData.leasingvendorid %]selected="selected"[% /if %]>[% $Vendor.vendornameshort%]</option>
                                                [% /foreach %]
                                            </select>
                                        </div>
                                    </div>
                                            
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('assetno')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='assetno' class='form-control' value="[% $CDData.assetno %]">
                                        </div>
                                    </div>

                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('purchasedate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='purchasedate' class='form-control datepicker' value="[% if $CDData.purchasedate %][% $CDData.purchasedate %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('deliverydate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='deliverydate' class='form-control datepicker' value="[% if $CDData.deliverydate %][% $CDData.deliverydate|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('purchaseprice')%] ([% $user->gettext('in Euro') %])</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='purchaseprice' class='form-control' value="[% $CDData.purchaseprice|string_format:"%.2f" %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('outdate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='outdate' class='form-control datepicker' value="[% if $CDData.outdate %][% $CDData.outdate|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>
                      
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('manupartnumber')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='manupartnumber' class='form-control' value="[% $CDData.manupartnumber %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingactiv')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='checkbox' name='leasingactiv' class='' value="[% $CDData.leasingactiv %]">
                                        </div>
                                    </div>
                                        
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingperiod')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingperiod' class='form-control' value="[% $CDData.leasingperiod  %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingrate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingrate' class='form-control' value="[% $CDData.leasingrate   %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingstartdate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingstartdate' class='form-control datepicker' value="[% if $CDData.leasingstartdate %][% $CDData.leasingstartdate|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingenddate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingenddate' class='form-control datepicker' value="[% if $CDData.leasingenddate %][% $CDData.leasingenddate|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingfactor')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingfactor' class='form-control' value="[% $CDData.leasingfactor   %]">
                                        </div>
                                    </div>
                                    
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingbasicprice')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingbasicprice' class='form-control' value="[% $CDData.leasingbasicprice|string_format:"%.2f"   %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingremainvalue')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingremainvalue' class='form-control' value="[% $CDData.leasingremainvalue   %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('leasingaccount')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='leasingaccount' class='form-control' value="[% $CDData.leasingaccount   %]">
                                        </div>
                                    </div>
                                        
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('warrantyend')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='warrantyend' class='form-control datepicker' value="[% if $CDData.warrantyend %][% $CDData.warrantyend|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afaactiv')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='checkbox' name='afaactiv' class='' value="[% $CDData.afaactiv %]">
                                        </div>
                                    </div>
                                   <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afabasicprice')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='afabasicprice' class='form-control' value="[% $CDData.afabasicprice|string_format:"%.2f"   %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afausingperiod')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='afausingperiod' class='form-control' value="[% $CDData.afausingperiod   %]">
                                        </div>
                                    </div>
                                        
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afausingperiod')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='afausingperiod' class='form-control' value="[% $CDData.afausingperiod   %]">
                                        </div>
                                    </div>
                                    
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afaaccount')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='afaaccount' class='form-control' value="[% $CDData.afaaccount   %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afastartdate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='afastartdate' class='form-control datepicker' value="[% if $CDData.afastartdate %][% $CDData.afastartdate|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>    
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('afaenddate')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='afaenddate' class='form-control datepicker' value="[% if $CDData.afaenddate %][% $CDData.afaenddate|date_format:"%d.%m.%Y %H:%M" %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('contactpersontitle')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='contactpersontitle' class='form-control' value="[% if $CDData.contactpersontitle %][% $CDData.contactpersontitle %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('contactpersonname')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='contactpersonname' class='form-control' value="[% if $CDData.contactpersonname %][% $CDData.contactpersonname %][% /if %]">
                                        </div>
                                    </div>
                                        
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('contactpersonphone')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='contactpersonphone' class='form-control' value="[% if $CDData.contactpersonphone %][% $CDData.contactpersonphone %][% /if %]">
                                        </div>
                                    </div>
                                    <div class="form-group row mb-3">
                                        <label class="col-sm-4 control-label">[% $user->gettext('deliverynote')%]</label>
                                        <div class='col-sm-8'>
                                            <input type='text' name='deliverynote' class='form-control' value="[% if $CDData.deliverynote %][% $CDData.deliverynote %][% /if %]">
                                        </div>
                                    </div>
                                </div>
                                        
                            </div>


                        </div>
                    </div>

                </div>
            </div>
        </form>                                                    
    </div>
</div>
                                        <script>
                                      
$(".datepicker").datepicker();

function closeIframe() {
    $("#myBigIFrameModal").modal('hide');
    window.location = window.location;
}
                                            </script>
