632 lines
32 KiB
PHP
632 lines
32 KiB
PHP
<?php //var_dump($order);exit; ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box">
|
|
<div class="page-title-right">
|
|
<ol class="breadcrumb m-0">
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>">the-tool</a></li>
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("Order")?>">Bestellungen</a></li>
|
|
<li class="breadcrumb-item active"><?=($order->id) ? "bearbeiten" : "Neu" ?></li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Bestellungen</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="header-title mb-2"><?=($order->id) ? "Bestellung bearbeiten" : "Neue Bestellung"?></h4>
|
|
|
|
<form class="form-horizontal" method="post" action="<?=self::getUrl("Order", "save")?>" enctype="multipart/form-data">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<input type="hidden" name="id" value="<?=$order->id?>" />
|
|
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
|
|
|
|
<div class="form-group row">
|
|
|
|
|
|
|
|
<div class="col-lg-12 mb-2">
|
|
<h4>Vertragsinhaber</h4>
|
|
<select class="form-control" name="owner_id" id="owner_id">
|
|
<option></option>
|
|
<option value="new" <?=($order->owner_id == "new") ? "selected='selected'" : ""?>>Neu...</option>
|
|
<?php foreach($addresses as $address): ?>
|
|
<option value="<?=$address->id?>" <?=($address->id == $order->owner_id) ? "selected='selected'" : ""?>><?=$address->getCompanyOrName()?> (<?=$address->zip?> <?=$address->city?>, <?=$address->street?>)</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-lg-12 hidden" id="owner-form">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_company">Firmenname</label>
|
|
<textarea class="form-control" name="owner_company" id="owner_company"><?=$order->owner_company?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_firstname">Vorname</label>
|
|
<input type="text" class="form-control" name="owner_firstname" id="owner_firstname" value="<?=$order->owner_firstname?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_lastname">Nachname</label>
|
|
<input type="text" class="form-control" name="owner_lastname" id="owner_lastname" value="<?=$order->owner_lastname?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_street">Straße *</label>
|
|
<input type="text" class="form-control" name="owner_street" id="owner_street" value="<?=$order->owner_street?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-3">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_zip">Postleitzahl *</label>
|
|
<input type="text" class="form-control" name="owner_zip" id="owner_zip" value="<?=$order->owner_zip?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-9">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_city">Ort *</label>
|
|
<input type="text" class="form-control" name="owner_city" id="owner_city" value="<?=$order->owner_city?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_country">Land</label>
|
|
<input type="text" class="form-control" name="owner_country" id="owner_country" value="<?=$order->owner_country?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_phone">Telefon *</label>
|
|
<input type="text" class="form-control" name="owner_phone" id="owner_phone" value="<?=$order->owner_phone?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_mobile">Mobil</label>
|
|
<input type="text" class="form-control" name="owner_mobile" id="owner_mobile" value="<?=$order->owner_mobile?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_email">Emailadresse *</label>
|
|
<input type="text" class="form-control" name="owner_email" id="owner_email" value="<?=$order->owner_email?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_fax">Fax</label>
|
|
<input type="text" class="form-control" name="owner_fax" id="owner_fax" value="<?=$order->owner_fax?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-lg-6">
|
|
|
|
<div class="form-group row">
|
|
|
|
<div class="col-lg-12 mb-2">
|
|
<h4>Rechungsadresse</h4>
|
|
<select class="form-control" name="billingaddress_id" id="billingaddress_id">
|
|
<option></option>
|
|
<option value="new" <?=($order->billingaddress_id == "new") ? "selected='selected'" : ""?>>Neu...</option>
|
|
<?php foreach($addresses as $address): ?>
|
|
<option value="<?=$address->id?>" <?=($address->id == $order->billingaddress_id) ? "selected='selected'" : ""?>><?=$address->getCompanyOrName()?> (<?=$address->zip?> <?=$address->city?>, <?=$address->street?>)</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-lg-12 hidden" id="billingaddress-form">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="form-group">
|
|
<label class="form-label" for="owner_company">Firmenname</label>
|
|
<textarea class="form-control" name="billing_company" id="billing_company"><?=$order->billing_company?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_firstname">Vorname</label>
|
|
<input type="text" class="form-control" name="billing_firstname" id="billing_firstname" value="<?=$order->billing_firstname?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_lastname">Nachname</label>
|
|
<input type="text" class="form-control" name="billing_lastname" id="billing_lastname" value="<?=$order->billing_lastname?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_street">Straße *</label>
|
|
<input type="text" class="form-control" name="billing_street" id="billing_street" value="<?=$order->billing_street?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-3">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_zip">Postleitzahl *</label>
|
|
<input type="text" class="form-control" name="billing_zip" id="billing_zip" value="<?=$order->billing_zip?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-9">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_city">Ort *</label>
|
|
<input type="text" class="form-control" name="billing_city" id="billing_city" value="<?=$order->billing_city?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_country">Land</label>
|
|
<input type="text" class="form-control" name="billing_country" id="billing_country" value="<?=$order->billing_country?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_phone">Telefon *</label>
|
|
<input type="text" class="form-control" name="billing_phone" id="billing_phone" value="<?=$order->billing_phone?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_mobile">Mobil</label>
|
|
<input type="text" class="form-control" name="billing_mobile" id="billing_mobile" value="<?=$order->billing_mobile?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_email">Emailadresse *</label>
|
|
<input type="text" class="form-control" name="billing_email" id="billing_email" value="<?=$order->billing_email?>" />
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="form-group">
|
|
<label class="form-label" for="billing_fax">Fax</label>
|
|
<input type="text" class="form-control" name="billing_fax" id="billing_fax" value="<?=$order->billing_fax?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="order_date">Bestelldatum</label>
|
|
<div class="col-lg-4">
|
|
<input type="text" class="form-control" name="order_date" id="order_date" value="<?=($order->order_date) ? date("d.m.Y", $order->order_date) : date("d.m.Y")?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<h4 class="header-title">Verrechnung</h4>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="billing_type">Verrechnungsart</label>
|
|
<div class="col-lg-10">
|
|
<select class="form-control" name="billing_type" id="billing_type">
|
|
<option value="sepa" <?=($order->billing_type == "sepa") ? "selected='selected'" : ""?>>SEPA Bankeinzug</option>
|
|
<option value="invoice" <?=($order->billing_type != "sepa") ? "selected='selected'" : ""?>>Rechnung</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="bank_account_bank">Kreitinstitut</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="bank_account_bank" id="bank_account_bank" value="<?=$order->bank_account_bank?>" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="bank_account_owner">Kontoinhaber</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="bank_account_owner" id="bank_account_owner" value="<?=$order->bank_account_owner?>" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="bank_account_iban">IBAN</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="bank_account_iban" id="bank_account_iban" value="<?=$order->bank_account_iban?>" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="bank_account_bic">BIC</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="bank_account_bic" id="bank_account_bic" value="<?=$order->bank_account_bic?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h4 class="header-title">Einwilligungen</h4>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="form-group row">
|
|
<div class="col-lg-2"></div>
|
|
<div class="col-lg-10">
|
|
<label class="form-check-label"><input type="checkbox" class="form-check-input" name="allow_contact" id="allow_contact" <?=($order->allow_contact) ? "checked='checked'" : ""?> /> Informationen per Post/Email/Telefon</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-lg-2"></div>
|
|
<div class="col-lg-10">
|
|
<label class="form-check-label"><input type="checkbox" class="form-check-input" name="allow_spin" id="allow_spin" <?=($order->allow_spin) ? "checked='checked'" : ""?> /> Auskunft mit Service PIN</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4>Produkte</h4>
|
|
|
|
<?php foreach($order->products as $product): ?>
|
|
<div class="row product-container">
|
|
<div class="col-md-1 product-<?=$product->id?>">
|
|
<!-- pos number -->
|
|
<div class="form-group">
|
|
<label class="form-label" for="pos-<?=$product->id?>">Position</label>
|
|
<input type="number" class="form-control" name="products[<?=$product->id?>][pos]" id="pos-<?=$product->id?>" value="<?=$product->pos?>" placeholder="Position" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-11">
|
|
<!-- product lines -->
|
|
<div class="row">
|
|
<!-- line 1 -->
|
|
<div class="col-5">
|
|
<label class="form-label" for="product_id-<?=$product->id?>">Produkt</label>
|
|
<select name="products[<?=$product->id?>][product_id]" id="product_id-<?=$product->id?>" class="form-control" onchange="updateProduct(<?=$product->id?>)">
|
|
<option></option>
|
|
<?php foreach($products as $p): ?>
|
|
<option value="<?=$p->id?>" <?=($p->id == $product->product_id) ? "selected='selected'" : ""?>><?=$p->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
|
|
</div>
|
|
<div class="col-3">
|
|
<label class="form-label" for="amount-<?=$product->id?>">Anzahl/Menge</label>
|
|
<input type="text" class="form-control" name="products[<?=$product->id?>][amount]" id="amount-<?=$product->id?>" value="<?=$product->formatAmount()?>" placeholder="Anzahl/Menge" />
|
|
</div>
|
|
<div class="col-2">
|
|
<label class="form-label" for="billing_period-<?=$product->id?>" >Verrechungsperiode</label>
|
|
<select class="form-control" name="products[<?=$product->id?>][billing_period]" id="billing_period-<?=$product->id?>" placeholder="Verrechnungsperiode">
|
|
<option value="12" <?=($product->billing_period == 12) ? "selected='selected'" : ""?>>Monatlich</option>
|
|
<option value="1"> <?=($product->billing_period == 1 ? "selected='selected'" : "")?>Jährlich</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-2">
|
|
<label class="form-label" for="price-<?=$product->id?>" >Preis p. Periode</label>
|
|
<input type="text" class="form-control" name="products[<?=$product->id?>][price]" id="price-<?=$product->id?>" value="<?=$this::dotToComma($product->price)?>" placeholder="Preis p. Periode" />
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row mt-1 mb-2">
|
|
<!-- line 2 -->
|
|
<div class="col-10">
|
|
<label class="form-label" for="description-<?=$product->id?>" >Zusatztext</label>
|
|
<textarea class="form-control" name="products[<?=$product->id?>][description]" id="description-<?=$product->id?>" placeholder="Zusatztext"><?=$product->description?></textarea>
|
|
</div>
|
|
<div class="col-2">
|
|
<label class="form-label" for="price_setup-<?=$product->id?>" >Preis Setup</label>
|
|
<input type="text" class="form-control" name="products[<?=$product->id?>][price_setup]" id="price_setup-<?=$product->id?>" value="<?=$this::dotToComma($product->price_setup)?>" placeholder="Preis Setup" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
|
|
<div class="row product-container">
|
|
|
|
<div class="col-md-1 product-new">
|
|
<!-- pos number -->
|
|
<div class="form-group">
|
|
<label class="form-label" for="pos-new" >Position</label>
|
|
<input type="number" class="form-control" name="products[new][pos]" id="pos-new" value="" placeholder="Position" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-11">
|
|
<!-- product lines -->
|
|
<div class="row">
|
|
<!-- line 1 -->
|
|
<div class="col-5">
|
|
<label class="form-label" for="product_id-new" >Produkt</label>
|
|
<select name="products[new][product_id]" id="product_id-new" class="form-control" onchange="updateProduct('new')">
|
|
<option></option>
|
|
<?php foreach($products as $p): ?>
|
|
<option value="<?=$p->id?>" <?=($p->id == $product->id) ? "checked='checked'" : ""?>><?=$p->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-3">
|
|
<label class="form-label" for="amount-new">Anzahl/Menge</label>
|
|
<input type="text" class="form-control" name="products[new][amount]" id="amount-new" value="" placeholder="Anzahl/Menge (Standard: 1)" />
|
|
</div>
|
|
<div class="col-2">
|
|
<label class="form-label" for="billing_period-new" >Verrechungsperiode</label>
|
|
<select class="form-control" name="products[new][billing_period]" id="billing_period-new" placeholder="Verrechnungsperiode">
|
|
<option value="12">Monatlich</option>
|
|
<option value="1">Jährlich</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-2">
|
|
<label class="form-label" for="price-new" >Preis p. Periode</label>
|
|
<input type="text" class="form-control" name="products[new][price]" id="price-new" value="" placeholder="Preis p. Periode" />
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row mt-1 mb-2">
|
|
<!-- line 2 -->
|
|
<div class="col-10">
|
|
<label class="form-label" for="description-new" >Zusatztext</label>
|
|
<textarea class="form-control" name="products[new][description]" id="description-new" placeholder="Zusatztext"></textarea>
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="price_setup-new" >Preis Setup</label>
|
|
<input type="text" class="form-control" name="products[new][price_setup]" id="price_setup-new" value="" placeholder="Preis Setup" />
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<h4>Dokumente</h4>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<?php if(!$order->id): ?>
|
|
<i>Verfügbar nach speichern.</i>
|
|
<?php else: ?>
|
|
|
|
<?php if(is_array($order->files) && count($order->files)): ?>
|
|
<table class="table table-striped table-hover">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Beschreibung</th>
|
|
<th>Dateiname</th>
|
|
<th>Original Dateiname</th>
|
|
<th>Hochgeladen</th>
|
|
<th>Zuletzt bearbeitet</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php foreach($order->files as $file): ?>
|
|
<tr>
|
|
<td><a href="<?=self::getUrl("File", "Download", ['id' => $file->file->id])?>"><?=$file->name?></a></td>
|
|
<td><?=nl2br($file->description)?></td>
|
|
<td><?=$file->file->filename?></td>
|
|
<td><?=$file->file->orig_filename?></td>
|
|
<td class="text-monospace"><?=date("d.m.Y", $file->create)?> (<?=$file->creator->name?>)</td>
|
|
<td class="text-monospace"><?=date("d.m.Y", $file->edit)?> (<?=$file->editor->name?>)</td>
|
|
<td>
|
|
<a href="<?=self::getUrl("OrderFile", "edit", ["id" => $file->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
|
<a href="<?=self::getUrl("OrderFile", "delete", ["id" => $file->id])?>" onclick="if(!confirm('Dokument wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
|
|
<h4>Neues Dokument</h4>
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="file_name">Name</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="file_name" id="file_name" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="file_filename">Download Dateiname</label>
|
|
<div class="col-lg-10">
|
|
<input type="text" class="form-control" name="file_filename" id="file_filename" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="file_description">Beschreibung</label>
|
|
<div class="col-lg-10">
|
|
<textarea class="form-control" name="file_description"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="note">Datei auswählen</label>
|
|
<div class="col-lg-10">
|
|
<input type="file" name="OrderFileUpload" class="form-control" />
|
|
<small>Erlaubte Dateiendungen: <?=MFUPLOAD_ALLOWED_EXTENSIONS_STR?></small>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="form-group row">
|
|
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
|
<div class="col-lg-10">
|
|
<textarea id="note" class="form-control" name="note" rows="5"><?=$order->note?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group row">
|
|
<label class="col-lg-2"></label>
|
|
<div class="col-lg-10">
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$("#owner_id").select2({
|
|
allowClear: true,
|
|
placeholder: ""
|
|
});
|
|
$("#billingaddress_id").select2({
|
|
allowClear: true,
|
|
placeholder: ""
|
|
});
|
|
|
|
$('#owner_id').change(function() {
|
|
var val = $('#owner_id').val();
|
|
|
|
if(val == "new") {
|
|
$('#owner-form').show();
|
|
} else {
|
|
$('#owner-form').hide();
|
|
}
|
|
});
|
|
|
|
$('#billingaddress_id').change(function() {
|
|
var val = $('#billingaddress_id').val();
|
|
|
|
if(val == "new") {
|
|
$('#billingaddress-form').show();
|
|
} else {
|
|
$('#billingaddress-form').hide();
|
|
}
|
|
});
|
|
|
|
$('#order_date').datepicker({
|
|
language: 'de',
|
|
format: "dd.mm.yyyy",
|
|
showWeekDays: true,
|
|
todayBtn: 'linked',
|
|
autoclose: true
|
|
});
|
|
|
|
|
|
// disable mousewheel on input number field when in focus
|
|
$('form').on('focus', 'input[type=number]', function (e) {
|
|
$(this).on('wheel.disableScroll', function (e) {
|
|
e.preventDefault()
|
|
})
|
|
});
|
|
$('form').on('blur', 'input[type=number]', function (e) {
|
|
$(this).off('wheel.disableScroll')
|
|
});
|
|
|
|
function updateProduct(id) {
|
|
var pid = $('#product_id-' + id).val();
|
|
|
|
$.get("<?=self::getUrl("Product", "Api")?>",
|
|
{
|
|
"do": "getProduct",
|
|
product_id: pid,
|
|
form_id: id
|
|
},
|
|
function (success) {
|
|
//console.log(success);
|
|
p = success.result.product;
|
|
id = success.result.form_id;
|
|
|
|
$('#billing_period-' + id).val(p.billing_period);
|
|
$('#price-' + id).val(p.price);
|
|
$('#price_setup-' + id).val(p.price_setup);
|
|
},
|
|
'json');
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
|