mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
added double manning checkbox & support
This commit is contained in:
@@ -79,11 +79,20 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="stock_cold-start">
|
||||
<label>
|
||||
<input type="checkbox" v-model="store.isColdStart" :disabled="!locoSupportsColdStart(store.stockList[0]?.constructionType || '')" />
|
||||
<div class="stock_spawn-settings">
|
||||
<label v-if="store.stockSupportsColdStart">
|
||||
<input type="checkbox" v-model="store.isColdStart" />
|
||||
{{ $t('stocklist.coldstart-info') }}
|
||||
</label>
|
||||
|
||||
<label v-if="store.stockSupportsDoubleManning">
|
||||
<input type="checkbox" v-model="store.isDoubleManned" />
|
||||
{{ $t('stocklist.doublemanning-info') }}
|
||||
</label>
|
||||
<!-- <label v-if="store.stockList.length > 0 && locoSupportsDoubleManning(store.stockList[0].constructionType)">
|
||||
<input type="checkbox" v-model="store.isDoubleManned" />
|
||||
{{ $t('stocklist.coldstart-info') }}
|
||||
</label> -->
|
||||
</div>
|
||||
|
||||
<div class="stock_warnings" v-if="stockHasWarnings">
|
||||
@@ -158,7 +167,6 @@ import { defineComponent } from 'vue';
|
||||
|
||||
import { useStore } from '../../store';
|
||||
|
||||
import { locoSupportsColdStart } from '../../utils/locoUtils';
|
||||
import warningsMixin from '../../mixins/warningsMixin';
|
||||
import imageMixin from '../../mixins/imageMixin';
|
||||
import stockPreviewMixin from '../../mixins/stockPreviewMixin';
|
||||
@@ -188,12 +196,19 @@ export default defineComponent({
|
||||
|
||||
computed: {
|
||||
stockString() {
|
||||
if (this.store.stockList.length == 0) return '';
|
||||
|
||||
const includeColdStart = this.store.isColdStart && this.store.stockSupportsColdStart;
|
||||
const includeDoubleManned = this.store.isDoubleManned && this.store.stockSupportsDoubleManning;
|
||||
|
||||
return this.store.stockList
|
||||
.map((stock, i) => {
|
||||
let stockTypeStr = stock.isLoco || !stock.cargo ? stock.type : `${stock.type}:${stock.cargo.id}`;
|
||||
let coldStart = i == 0 && this.store.isColdStart && locoSupportsColdStart(stock.constructionType || '') ? ',c' : '';
|
||||
|
||||
return stockTypeStr + coldStart;
|
||||
if (i == 0 && (includeColdStart || includeDoubleManned))
|
||||
return `${stockTypeStr},${includeColdStart ? 'c' : ''}${includeDoubleManned ? 'd' : ''}`;
|
||||
|
||||
return stockTypeStr;
|
||||
})
|
||||
.join(';');
|
||||
},
|
||||
@@ -212,8 +227,6 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
methods: {
|
||||
locoSupportsColdStart,
|
||||
|
||||
copyToClipboard() {
|
||||
navigator.clipboard.writeText(this.stockString);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
<td v-if="currentFilterMode == 'carriages'">{{ !isLocomotive(vehicle) ? vehicle.cargoList.length : '---' }}</td>
|
||||
<td v-if="currentFilterMode == 'tractions'">
|
||||
{{ isLocomotive(vehicle) ? (locoSupportsColdStart(vehicle.constructionType) ? `✓` : '✗') : '---' }}
|
||||
{{ isLocomotive(vehicle) ? (vehicle.coldStart ? `✓` : '✗') : '---' }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -86,7 +86,6 @@ import { Vehicle } from '../../types';
|
||||
import { isLocomotive } from '../../utils/vehicleUtils';
|
||||
import stockMixin from '../../mixins/stockMixin';
|
||||
import imageMixin from '../../mixins/imageMixin';
|
||||
import { locoSupportsColdStart } from '../../utils/locoUtils';
|
||||
|
||||
type SorterID = 'type' | 'constructionType' | 'image' | 'length' | 'mass' | 'maxSpeed' | 'cargoCount' | 'group' | 'coldStart';
|
||||
|
||||
@@ -143,7 +142,6 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
methods: {
|
||||
locoSupportsColdStart,
|
||||
isLocomotive,
|
||||
|
||||
toggleFilter(name: typeof this.currentFilterMode) {
|
||||
@@ -180,7 +178,10 @@ export default defineComponent({
|
||||
);
|
||||
|
||||
case 'coldStart':
|
||||
return (locoSupportsColdStart(row1.vehicle.constructionType) > locoSupportsColdStart(row2.vehicle.constructionType) ? 1 : -1) * direction;
|
||||
return (
|
||||
((isLocomotive(row1.vehicle) && row1.vehicle.coldStart ? 1 : -1) - (isLocomotive(row2.vehicle) && row2.vehicle.coldStart ? 1 : -1)) *
|
||||
direction
|
||||
);
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -200,8 +201,6 @@ export default defineComponent({
|
||||
(this.currentFilterMode == 'all' ||
|
||||
(this.currentFilterMode == 'tractions' && isLocomotive(vehicle)) ||
|
||||
(this.currentFilterMode == 'carriages' && !isLocomotive(vehicle))),
|
||||
|
||||
// ((this.filters.tractions && isLocomotive(vehicle)) || (this.filters.carriages && !isLocomotive(vehicle))),
|
||||
}))
|
||||
.sort((a, b) => this.sortTableRows(a, b));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user