switched 2 inputs

This commit is contained in:
Luca Haid
2024-11-21 09:12:44 +00:00
parent 11ec0cf97b
commit 0cf35b19b1
8 changed files with 115 additions and 34 deletions

View File

@@ -148,5 +148,9 @@ TODO: enable option for showing prices
</div>
<?php endif; ?>
<div style="padding-top: 16pt">
Die Ware bleibt bis zur vollständigen Bezahlung Eigentum der XINON GmbH.
</div>
</body>
</html>

View File

@@ -498,4 +498,4 @@ class WarehouseShippingNoteController extends TTCrud {
self::returnJson(['success' => true, 'distance' => $roundedDistanceKm]);
}
}
}

View File

@@ -9,7 +9,7 @@ class WarehouseShippingNoteModel extends TTCrudBaseModel {
public string $deliveryAddressCity;
public string $deliveryAddressEMail;
public string $note;
public string $status; // 'new'|'accepted'|'invoiced'
public string $status; // 'new'|'in_progress'|'accepted'|'invoiced' TODO: add to enum / migration
public string $positions;
public string $textElements;
public string $hoursEntries;

View File

@@ -0,0 +1,26 @@
<?php /** @noinspection ALL */
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class WarehouseModify3 extends AbstractMigration {
public function up(): void {
if ($this->getEnvironment() == "thetool") {
$WarehouseShippingNote = $this->table("WarehouseShippingNote", ["signed" => true]);
$WarehouseShippingNote->changeColumn("status", "enum", ["values" => ["new", "accepted", "invoiced", "in_progress"], "null" => false]);
$WarehouseShippingNote->save();
}
if ($this->getEnvironment() == "addressdb") {
}
}
public function down(): void {
if ($this->getEnvironment() == "thetool") {
$WarehouseShippingNote = $this->table("WarehouseShippingNote");
$WarehouseShippingNote->changeColumn("status", "enum", ["values" => ["new", "accepted", "invoiced"], "null" => false]);
$WarehouseShippingNote->save();
}
}
}

View File

@@ -28,6 +28,10 @@ class Helper {
} else if (!empty($filterValue)) {
if ($exactMatch) {
$sql .= " AND `$columnName` = '" . $filterValue . "'";
} else if ($filterValue[0] === "%") {
$sql .= " AND `$columnName` LIKE '" . $filterValue . "'";
} else if ($filterValue[strlen($filterValue) - 1] === "%") {
$sql .= " AND `$columnName` LIKE '" . $filterValue . "'";
} else {
$filterItems = explode(" ", $filterValue);
foreach ($filterItems as $item) {

View File

@@ -124,6 +124,10 @@ class TTCrud extends mfBaseController {
$page = $this->postData['pagination']['page'] ?? 1;
$perPage = $this->postData['pagination']['per_page'] ?? 10;
if ($order['key'] === null && isset($this->defaultOrder)) {
$order = $this->defaultOrder;
}
$rows = $this->model::getAll($filter, $perPage, ($page - 1) * $perPage, $order);
$filteredAvailable = $this->model::count($filter);
$totalRows = $this->model::count();
@@ -240,11 +244,19 @@ class TTCrud extends mfBaseController {
if (strlen($searchedID) > 0) {
$filter = ['id' => $searchedID];
$data = $this->model::getAll($filter, 10);
} else {
$filter = [$textKey => $this->request->q];
$filter = [$textKey => $this->request->q . '%'];
$data = $this->model::getAll($filter, 10);
if (count($data) < 11) {
$filter = [$textKey => $this->request->q];
$lazyData = $this->model::getAll($filter, 10);
$data = array_merge($data, $lazyData);
$data = array_unique($data, SORT_REGULAR);
$data = array_slice($data, 0, 10);
}
}
$data = $this->model::getAll($filter, 10);
self::returnJson(array_map(function ($item) use ($textKey) {
return ['value' => $item->id, 'text' => $item->$textKey];

View File

@@ -246,6 +246,7 @@ Vue.component('warehouse-article-price-modal', {
})
// noinspection EqualityComparisonWithCoercionJS
Vue.component('warehouse-article', {
//language=Vue
template: `
@@ -261,7 +262,7 @@ Vue.component('warehouse-article', {
<template v-slot:cheapestsellprice="{ row }">
<template v-for="price in JSON.parse(row.cheapestSellPrice)">
<span v-if="price && window.TT_CONFIG['WAREHOUSE_ADMIN'] === true">{{price.title}}: {{(price.price)}} €<br></span>
<span v-if="price && window.TT_CONFIG['WAREHOUSE_ADMIN'] == true">{{price.title}}: {{(price.price)}} €<br></span>
<span v-if="price && price.title === 'Verkauf'">{{(price.price)}} €</span>
</template>
</template>

View File

@@ -57,7 +57,7 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', {
<tt-input v-model="hourCount" label="Stunden" sm/>
<tt-autocomplete v-model="carId" :api-url="carApiUrl" label="Fahrzeug" sm/>
<tt-input v-model="hourlyPrice" label="Stundenlohn" type="number" sm v-if="showHourlyPrice"/>
<tt-input v-model="kilometerCount" label="Kilometer" sm/>
<tt-input :disabled="carId === ''" v-model="kilometerCount" label="Kilometer" sm/>
<div class="warehouse-shipping-note-modal-hours-entry-actions">
<button @click="createOrUpdate" class="btn btn-sm btn-primary">Speichern</button>
</div>
@@ -87,6 +87,10 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', {
this.updateCarId().then();
},
async updateKilometerCount() {
if (!this.carId) {
this.kilometerCount = '';
return;
}
const delAddr = this.$parent.$parent.$parent.delAddrLine +
' ' +
this.$parent.$parent.$parent.delAddrCity +
@@ -122,6 +126,8 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', {
if (!this.kilometerCount) this.updateKilometerCount().then();
this.$parent.$parent.$parent.$watch('delAddrLine', this.updateKilometerCount);
this.$watch('carId', this.updateKilometerCount);
}
})
@@ -429,6 +435,7 @@ Vue.component('warehouse-shipping-note-modal-positions', {
})
// noinspection EqualityComparisonWithCoercionJS
Vue.component('warehouse-shipping-note-modal', {
props: {
id: {type: [String, Number], required: true},
@@ -464,10 +471,12 @@ Vue.component('warehouse-shipping-note-modal', {
:del-addr-e-mail.sync="delAddrEMail"/>
<div v-show="delAddrFilled === false">
<hr>
<h4 class="text-center">Textelemente</h4>
<warehouse-shipping-note-modal-text-elements :text-elements="textElements"/>
<div v-show="delAddrFilled === true">
<template v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] == true && 1 < 0">
<hr>
<h4 class="text-center">Textelemente</h4>
<warehouse-shipping-note-modal-text-elements :text-elements="textElements"/>
</template>
<hr>
@@ -484,14 +493,21 @@ Vue.component('warehouse-shipping-note-modal', {
<warehouse-shipping-note-modal-positions :positions.sync="positions" :bill-addr-id="billAddrId"/>
</div>
<div v-show="delAddrFilled === true" class="text-center">Bitte füllen Sie die Rechnungs- und Lieferadresse aus</div>
<div v-show="delAddrFilled === false" class="text-center">Bitte füllen Sie die Rechnungs- und Lieferadresse aus</div>
</div>
<!-- TODO: fix these buttons-->
<template v-slot:footer-prepend v-if="id !== 'create'">
<button v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] == true && status === 'new'" class="btn btn-warning" @click="alert('In Bearbeitung')">In
Bearbeitung
</button>
<button v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] == true && (status === 'new' || status === 'in_progress')" class="btn btn-success"
@click="alert('Accepted')">Akzeptieren
</button>
<button v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] == true && status === 'accepted'" class="btn btn-info" @click="alert('Invoiced')">
Verrechnet
</button>
<button class="btn btn-info" @click="$emit('open-signing-modal', id)">Unterschreiben</button>
<!-- <button class="btn btn-success" @click="alert('Accept')">Akzeptieren</button>-->
<!-- <button class="btn btn-warning" @click="alert('Invoiced')">Verrechnet</button>-->
</template>
</tt-modal>
`,
@@ -559,7 +575,8 @@ Vue.component('warehouse-shipping-note-modal', {
return this.id === 'create' ? 'Lieferschein erstellen' : `Lieferschein #${this.id} bearbeiten`;
},
delAddrFilled() {
return !this.delAddrName || !this.delAddrLine || !this.delAddrPLZ || !this.delAddrCity;
if (this.id !== 'create') return true;
return !!this.delAddrName && !!this.delAddrLine && !!this.delAddrPLZ && !!this.delAddrCity;
}
}
@@ -576,14 +593,14 @@ Vue.component('warehouse-shipping-note-modal-address', {
},
data() {
return {
window: window,
addressModes: [{text: 'Wie Rechnungsadresse', value: 'billing'},
{text: 'Bestehende Lieferadresse', value: 'existing'},
{text: 'Andere Lieferadresse', value: 'new'}],
addressMode: 'existing',
addresses: [],
fetchedBillAddr: null,
selectedAddr: '',
window: window,
addressModes: [{text: 'Wie Rechnungsadresse', value: 'billing'},
{text: 'Bestehende Lieferadresse', value: 'existing'},
{text: 'Andere Lieferadresse', value: 'new'}],
addressMode: 'existing',
addresses: [],
fetchedBillAddr: null,
selectedAddr: '',
newAddrGeoLatLon: '',
}
},
@@ -599,31 +616,48 @@ Vue.component('warehouse-shipping-note-modal-address', {
<template v-else-if="addressMode === 'new'">
<tt-input :value="delAddrName" @input="$emit('update:delAddrName', $event)" label="Lieferadresse Name*" sm row/>
<tt-input :value="delAddrEMail" @input="$emit('update:delAddrEMail', $event)" label="Lieferadresse E-Mail" sm row/>
<tt-autocomplete :api-url="window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/geoAutocomplete'" @input="newAddrGeoLatLon = $event" label="Adresse*" sm row/>
<tt-autocomplete :api-url="window.TT_CONFIG['BASE_PATH'] + '/WarehouseShippingNote/geoAutocomplete'" @input="newAddrGeoLatLon = $event"
label="Adresse*" sm row/>
<span v-if="delAddrLine && delAddrPLZ && delAddrCity">Adresse: {{ delAddrLine }}, {{ delAddrPLZ }} {{ delAddrCity }}</span>
<!-- <tt-input :value="delAddrLine" @input="$emit('update:delAddrLine', $event)" label="Lieferadresse" sm row/>-->
<!-- <tt-input :value="delAddrPLZ" @input="$emit('update:delAddrPLZ', $event)" label="Lieferadresse PLZ" sm row/>-->
<!-- <tt-input :value="delAddrCity" @input="$emit('update:delAddrCity', $event)" label="Lieferadresse Ort" sm row/>-->
<!-- <tt-input :value="delAddrLine" @input="$emit('update:delAddrLine', $event)" label="Lieferadresse" sm row/>-->
<!-- <tt-input :value="delAddrPLZ" @input="$emit('update:delAddrPLZ', $event)" label="Lieferadresse PLZ" sm row/>-->
<!-- <tt-input :value="delAddrCity" @input="$emit('update:delAddrCity', $event)" label="Lieferadresse Ort" sm row/>-->
</template>
</div>
`,
watch: {
billAddrId: {handler: 'updateBillingMode', immediate: false},
addressMode: {handler: 'fetchDeliveryAddresses', immediate: false},
selectedAddr: {handler: 'setSelectedAddrValues', immediate: false},
billAddrId: {handler: 'updateBillingMode', immediate: false},
addressMode: {handler: 'fetchDeliveryAddresses', immediate: false},
selectedAddr: {handler: 'setSelectedAddrValues', immediate: false},
newAddrGeoLatLon: {handler: 'fetchGeoAddress', immediate: false},
},
methods: {
async fetchGeoAddress() {
if (!this.newAddrGeoLatLon) return;
if (!this.newAddrGeoLatLon) {
this.$emit('update:delAddrLine', '');
this.$emit('update:delAddrPLZ', '');
this.$emit('update:delAddrCity', '');
return;
}
const [lat, lon] = this.newAddrGeoLatLon.split(',');
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/geoReverse?lat=' + lat + '&lon=' + lon);
if (response.data.address.road) {
this.$emit('update:delAddrLine', `${response.data.address.road}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
} else {
this.$emit('update:delAddrLine', `${response.data.address.village}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
this.$emit('update:delAddrLine',
`${response.data.address.road}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
} else if(response.data.address.village) {
this.$emit('update:delAddrLine',
`${response.data.address.village}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
} else if(response.data.address.hamlet) {
this.$emit('update:delAddrLine',
`${response.data.address.hamlet}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
} else if(response.data.address.residential) {
this.$emit('update:delAddrLine',
`${response.data.address.residential}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
} else if(response.data.address.city) {
this.$emit('update:delAddrLine',
`${response.data.address.city}${response.data.address.house_number ? ' ' + response.data.address.house_number : ''}`);
}
this.$emit('update:delAddrPLZ', response.data.address.postcode);