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

273 lines
12 KiB
Smarty
Raw Normal View History

<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">
<option value="0">Haus</option>
<option value="1">Packstation</option>
<option value="2">Filiale</option>
</select>
</td>
2022-10-29 21:38:28 +02:00
</tr>
<tr>
2022-11-22 00:21:57 +01:00
<td>{|Name / Zeile 1|}:</td>
<td><input type="text" size="36" v-model.trim="form.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">
<td>{|Firmenname / Zeile 2|}:</td>
<td><input type="text" size="36" v-model.trim="form.name2"></td>
</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>
<tr v-if="form.addresstype === 0">
<td>{|Firmenname / Zeile 3|}:</td>
<td><input type="text" size="36" v-model.trim="form.name3"></td>
</tr>
<tr v-if="form.addresstype === 0">
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>
<tr v-if="form.addresstype === 0">
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>
2022-10-29 21:38:28 +02:00
<option v-for="(value, key) in countries" :value="key">{{value}}</option>
</select>
</td>
</tr>
2022-11-22 00:21:57 +01:00
<tr>
<td>{|Ansprechpartner|}:</td>
<td><input type="text" size="36" v-model="form.contactperson"></td>
</tr>
2022-10-29 21:38:28 +02:00
<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>
<td>{|Gewicht (in kg)|}:</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">{{prod.Name}}</option>
2022-10-29 21:38:28 +02:00
</select>
</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">
<h2>{|Bestellung|}</h2>
<table>
<tr>
<td>{|Bestellnummer|}:</td>
<td><input type="text" size="36" v-model="form.order_number"></td>
</tr>
<tr>
<td>{|Rechnungsnummer|}:</td>
<td><input type="text" size="36" v-model="form.invoice_number"></td>
</tr>
<tr>
<td>{|Sendungsart|}:</td>
<td>
<select v-model="form.shipment_type">
2022-10-29 21:38:28 +02:00
<option v-for="(value, key) in customs_shipment_types" :value="key">{{value}}</option>
</select>
</td>
</tr>
<tr>
<td>{|Versicherungssumme|}:</td>
<td><input type="text" size="10" v-model="form.total_insured_value"/></td>
</tr>
</table>
</div>
<div class="col-md-12">
<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">&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],
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;
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;
}
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);
},
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;
2022-10-29 21:38:28 +02:00
}
}
})
</script>