OpenXE/www/lib/versandarten/content/createshipment.tpl

313 lines
14 KiB
Smarty
Raw Normal View History

2023-02-28 13:36:25 +01:00
<!--
SPDX-FileCopyrightText: 2022 Andreas Palm
SPDX-License-Identifier: LicenseRef-EGPL-3.1
-->
<div class="container-fluid" id="createshipmentapp">
2022-10-29 21:38:28 +02:00
<form action="" method="post" v-on:submit.prevent="submit">
<div class="row">
<div v-for="msg in messages" :class="msg.class">{{msg.text}}</div>
<div>
<h1>{|Paketmarken Drucker f&uuml;r|} [CARRIERNAME]</h1>
2022-10-29 21:38:28 +02:00
</div>
<div class="col-md-4">
<h2>{|Empf&auml;nger|}</h2>
<table>
<tr>
2022-11-22 00:21:57 +01:00
<td>{|Adresstyp|}:</td>
<td>
<select v-model.number="form.addresstype">
2024-07-13 14:46:58 +02:00
<option value="0">Firma</option>
2022-11-22 00:21:57 +01:00
<option value="1">Packstation</option>
<option value="2">Filiale</option>
2024-07-13 14:46:58 +02:00
<option value="3">Privatadresse</option>
2022-11-22 00:21:57 +01:00
</select>
</td>
2022-10-29 21:38:28 +02:00
</tr>
2024-07-13 14:46:58 +02:00
<tr v-if="form.addresstype === 0">
<td>{|Firma|}:</td>
<td><input type="text" size="36" v-model.trim="form.company_name"></td>
2022-10-29 21:38:28 +02:00
</tr>
2022-11-22 00:21:57 +01:00
<tr v-if="form.addresstype === 0">
2024-07-13 14:46:58 +02:00
<td>{|Abteilung|}:</td>
<td><input type="text" size="36" v-model.trim="form.company_division"></td>
</tr>
<tr v-if="form.addresstype === 3">
<td>{|Name|}:</td>
<td><input type="text" size="36" v-model.trim="form.name"></td>
</tr>
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
<td>{|Ansprechpartner|}:</td>
<td><input type="text" size="36" v-model.trim="form.contact_name"></td>
2022-11-22 00:21:57 +01:00
</tr>
<tr v-if="form.addresstype === 1 || form.addresstype === 2">
<td>{|Postnummer|}:</td>
<td><input type="text" size="36" v-model.trim="form.postnumber"></td>
</tr>
2024-07-13 14:46:58 +02:00
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
2022-10-29 21:38:28 +02:00
<td>{|Strasse/Hausnummer|}:</td>
<td>
<input type="text" size="30" v-model.trim="form.street">
<input type="text" size="5" v-model.trim="form.streetnumber">
2022-10-29 21:38:28 +02:00
</td>
</tr>
2022-11-22 00:21:57 +01:00
<tr v-if="form.addresstype === 1">
<td>{|Packstationsnummer|}:</td>
<td><input type="text" size="10" v-model.trim="form.parcelstationNumber"></td>
</tr>
<tr v-if="form.addresstype === 2">
<td>{|Postfilialnummer|}:</td>
<td><input type="text" size="10" v-model.trim="form.postofficeNumber"></td>
</tr>
2024-07-13 14:46:58 +02:00
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
2022-10-29 21:38:28 +02:00
<td>{|Adresszeile 2|}:</td>
<td><input type="text" size="36" v-model.trim="form.address2"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|PLZ/Ort|}:</td>
<td><input type="text" size="5" v-model.trim="form.zip">
<input type="text" size="30" v-model.trim="form.city">
2022-10-29 21:38:28 +02:00
</td>
</tr>
<tr>
<td>{|Bundesland|}:</td>
<td><input type="text" size="36" v-model.trim="form.state"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Land|}:</td>
<td>
<select v-model="form.country" required>
<option v-for="(value, key) in countries" :value="key">{{value.name}}</option>
2022-10-29 21:38:28 +02:00
</select>
</td>
</tr>
<tr>
<td>{|E-Mail|}:</td>
<td><input type="text" size="36" v-model.trim="form.email"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Telefon|}:</td>
<td><input type="text" size="36" v-model.trim="form.phone"></td>
2022-10-29 21:38:28 +02:00
</tr>
2022-10-29 21:38:28 +02:00
</table>
</div>
<div class="col-md-4" v-once>
<h2>vollst. Adresse</h2>
<table>
<tr>
<td>{|Name|}</td>
<td>{{form.original.name}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Ansprechpartner|}</td>
<td>{{form.original.ansprechpartner}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Abteilung|}</td>
<td>{{form.original.abteilung}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Unterabteilung|}</td>
<td>{{form.original.unterabteilung}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Adresszusatz|}</td>
<td>{{form.original.adresszusatz}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Strasse|}</td>
<td>{{form.original.strasse}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|PLZ/Ort|}</td>
<td>{{form.original.plz}} {{form.original.ort}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Bundesland|}</td>
<td>{{form.original.bundesland}}</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Land|}</td>
<td>{{form.original.land}}</td>
2022-10-29 21:38:28 +02:00
</tr>
</table>
</div>
<div class="col-md-4">
<h2>{|Paket|}</h2>
<table>
<tr>
2023-10-26 20:51:47 +02:00
<td>{|Gewicht (in kg)</b>|}:</td>
<td><input type="text" v-model.number="form.weight"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|H&ouml;he (in cm)|}:</td>
<td><input type="text" size="10" v-model.number="form.height"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Breite (in cm)|}:</td>
<td><input type="text" size="10" v-model.number="form.width"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|L&auml;nge (in cm)|}:</td>
<td><input type="text" size="10" v-model.number="form.length"></td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
<td>{|Produkt|}:</td>
<td>
2022-11-22 00:21:57 +01:00
<select v-model="form.product" required>
<option v-for="prod in products" :value="prod.Id" v-if="productAvailable(prod)">{{prod.Name}}</option>
2023-10-26 20:51:47 +02:00
</select><i>F&uuml;r Produktwahl Gewicht eingeben!</i>
2022-10-29 21:38:28 +02:00
</td>
</tr>
<tr v-if="serviceAvailable('premium')">
<td>{|Premium|}:</td>
<td><input type="checkbox" v-model="form.services.premium"></td>
</tr>
2022-10-29 21:38:28 +02:00
</table>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
2023-10-26 20:56:18 +02:00
<h2>{|Sonstiges|}</h2>
2022-10-29 21:38:28 +02:00
<table>
<tbody>
<tr>
2023-10-26 20:56:18 +02:00
<td>{|Referenzen|}:</td>
<td><input type="text" size="36" v-model="form.order_number"></td>
</tr>
<tr>
<td>{|Versicherungssumme|}:</td>
<td><input type="text" size="10" v-model="form.total_insured_value"/></td>
</tr>
</tbody>
<tbody v-if="customsRequired()">
<tr>
<td>{|Rechnungsnummer|}:</td>
<td><input type="text" size="36" v-model="form.invoice_number" required="required"></td>
</tr>
<tr>
<td>{|Sendungsart|}:</td>
<td>
<select v-model="form.shipment_type">
<option v-for="(value, key) in customs_shipment_types" :value="key">{{value}}</option>
</select>
</td>
</tr>
</tbody>
2022-10-29 21:38:28 +02:00
</table>
</div>
<div class="col-md-12" v-if="customsRequired()">
2022-10-29 21:38:28 +02:00
<table>
<tr>
<th>{|Bezeichnung|}</th>
<th>{|Menge|}</th>
<th>{|HSCode|}</th>
<th>{|Herkunftsland|}</th>
<th>{|Einzelwert|}</th>
<th>{|Einzelgewicht|}</th>
<th>{|Gesamtwert|}</th>
<th>{|Gesamtgewicht|}</th>
2022-11-22 00:21:57 +01:00
<th><a v-on:click="addPosition"><img src="themes/new/images/add.png"></a></
</th>
2022-10-29 21:38:28 +02:00
</tr>
<tr v-for="(pos, index) in form.positions">
<td><input type="text" v-model.trim="pos.bezeichnung" required></td>
<td><input type="text" v-model.number="pos.menge" required></td>
2022-11-22 00:21:57 +01:00
<td><input type="text" v-model.trim="pos.zolltarifnummer"></td>
<td><input type="text" v-model.trim="pos.herkunftsland"></td>
<td><input type="text" v-model.number="pos.zolleinzelwert"></td>
<td><input type="text" v-model.number="pos.zolleinzelgewicht"></td>
2022-10-29 21:38:28 +02:00
<td>{{Number(pos.menge*pos.zolleinzelwert || 0).toFixed(2)}}</td>
<td>{{Number(pos.menge*pos.zolleinzelgewicht || 0).toFixed(3)}}</td>
<td><a v-on:click="deletePosition(index)"><img src="themes/new/images/delete.svg"></a></td>
</tr>
<tr>
<td colspan="6"></td>
2022-10-29 21:38:28 +02:00
<td>{{total_value.toFixed(2)}}</td>
<td>{{total_weight.toFixed(3)}}</td>
</tr>
</table>
</div>
<div>
<input class="btnGreen" type="submit" value="{|Paketmarke drucken|}" name="drucken" :disabled="submitting">&nbsp;
<!--<input type="button" value="{|Andere Versandart auswählen|}" name="anders">&nbsp;-->
2022-10-29 21:38:28 +02:00
</div>
</div>
</form>
</div>
<script type="text/javascript">
const createshipmentapp = new Vue({
el: '#createshipmentapp',
data: [JSON],
mounted() {
this.autoselectproduct();
},
2022-10-29 21:38:28 +02:00
computed: {
total_value() {
let sum = 0;
2022-11-22 00:21:57 +01:00
for (const pos of this.form.positions) {
sum += (pos.menge * pos.zolleinzelwert) || 0;
2022-10-29 21:38:28 +02:00
}
return sum;
},
total_weight() {
let sum = 0;
2022-11-22 00:21:57 +01:00
for (const pos of this.form.positions) {
sum += (pos.menge * pos.zolleinzelgewicht) || 0;
2022-10-29 21:38:28 +02:00
}
return sum;
}
},
methods: {
2022-11-22 00:21:57 +01:00
submit: function () {
2022-10-29 21:38:28 +02:00
let app = this;
app.submitting = true;
2022-10-29 21:38:28 +02:00
let xhr = new XMLHttpRequest();
xhr.open('POST', location.href, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function () {
let json = JSON.parse(this.response);
app.messages = json.messages;
app.submitting = false;
2022-10-29 21:38:28 +02:00
}
xhr.send(JSON.stringify($.extend({submit:'print'}, this.form)));
},
2022-11-22 00:21:57 +01:00
addPosition: function () {
this.form.positions.push({});
2022-10-29 21:38:28 +02:00
},
2022-11-22 00:21:57 +01:00
deletePosition: function (index) {
2022-10-29 21:38:28 +02:00
this.form.positions.splice(index, 1);
},
productAvailable: function (product) {
if (product == undefined)
return false;
if (product.WeightMin > this.form.weight || product.WeightMax < this.form.weight)
return false;
return true;
},
2022-11-22 00:21:57 +01:00
serviceAvailable: function (service) {
if (!this.products.hasOwnProperty(this.form.product))
return false;
return this.products[this.form.product].AvailableServices.indexOf(service) >= 0;
},
customsRequired: function () {
return this.countries[this.form.country].eu == '0';
},
autoselectproduct: function () {
if (!this.productAvailable(this.products[this.form.product])) {
for (prod in this.products) {
if (!this.productAvailable(this.products[prod]))
continue;
this.form.product = prod;
break;
}
}
}
},
beforeUpdate: function () {
this.autoselectproduct();
2022-10-29 21:38:28 +02:00
}
})
2023-10-26 20:51:47 +02:00
</script>