enhace add mopre : export interface TowTruckType { name: string capacity: string perKm:…
Jump to turn (6)
- User
enhace add mopre : export interface TowTruckType { name: string capacity: string perKm: number maneuverCharge: number flagDropFee: number maxWeight: number }
export const towTruckTypes: Record<string, TowTruckType> = { A: { name: 'Grúa tipo A', capacity: 'hasta 2000kg', perKm: 18.82, maneuverCharge: 1219.55, flagDropFee: 528.69, maxWeight: 2000, }, B: { name: 'Grúa tipo B', capacity: 'hasta 3000kg', perKm: 20.62, maneuverCharge: 1336.73, flagDropFee: 607.43, maxWeight: 3000, }, C: { name: 'Grúa tipo C', capacity: 'hasta 4000kg', perKm: 23.47, maneuverCharge: 1524.21, flagDropFee: 721.79, maxWeight: 4000, }, D: { name: 'Grúa tipo D', capacity: 'hasta 8000kg', perKm: 32.35, maneuverCharge: 2101.65, flagDropFee: 885.84, maxWeight: 8000, }, }
// Vehicle type detection logic export const getTruckTypeForVehicle = ( model: string, ): 'A' | 'B' | 'C' | 'D' => { const modelLower = model.toLowerCase()
if (isTypeDVehicle(modelLower)) return 'D' if (isTypeCVehicle(modelLower)) return 'C' if (isTypeBVehicle(modelLower)) return 'B' return 'A' }
const isTypeDVehicle = (model: string): boolean => { const typeDVehicles = [ 'f-150', 'f-250', 'f-350', 'f-450', 'silverado', 'sierra', 'ram', 'tundra', 'titan', 'super duty', 'power wagon', 'sprinter', 'transit', 'promaster', ]
const heavyKeywords = [ 'heavy duty', 'commercial', 'camion', 'truck', '2500', '3500', '4500', '5500', ]
return ( typeDVehicles.some((v) => model.includes(v)) || heavyKeywords.some((k) => model.includes(k)) ) }
const isTypeCVehicle = (model: string): boolean => { const typeCVehicles = [ 'murano', 'pathfinder', 'highlander', 'pilot', '4runner', 'expedition', 'tahoe', 'suburban', 'sequoia', 'armada', 'telluride', 'palisade', ]
const largeKeywords = [ 'full-size', 'large suv', 'luxury suv', 'van', 'executive', ]
return ( typeCVehicles.some((v) => model.includes(v)) || largeKeywords.some((k) => model.includes(k)) ) }
const isTypeBVehicle = (model: string): boolean => { const typeBVehicles = [ 'rav4', 'cr-v', 'rogue', 'tucson', 'sportage', 'equinox', 'escape', 'compass', 'cherokee', 'forester', 'outback', 'cx-5', ]
const mediumKeywords = [ 'suv', 'crossover', 'pickup', 'mid-size', 'compact suv', ]
return ( typeBVehicles.some((v) => model.includes(v)) || mediumKeywords.some((k) => model.includes(k)) ) }
To enhance your existing TypeScript code for the TowTruckType interface and vehicle type detection logic, we can introduce additional fields to the TowTruckType interface, add new tow truck types, and improve vehicle type detection with more comprehensive logic. Here's an expanded version of your code with these enhancements:
only exist a to d, only add more vehicles
Sure! Let's enhance the vehicle type detection logic by adding more vehicles to the existing types (A, B, C, and D) without adding a new truck type E. I'll retain the original truck types and focus solely on expanding the lists of vehicles for each type. Here’s the revised code:
ad more options
Absolutely! Let's add even more vehicle options for each tow truck type (A, B, C, and D). Here’s the updated code with additional vehicle models for each category:
add option for b y c
Sure! Let's add more options specifically for truck types B and C in the vehicle detection logic. Below is the updated code with additional vehicles for both Type B and Type C:
complete comp
Certainly! To make the vehicle detection logic more complete, I will ensure that the lists for Types B and C are entirely filled with relevant vehicles. Below is the updated code including more comprehensive options for both Type B (which typically includes compact SUVs and crossovers) and Type C (which generally covers larger SUVs and vans).
add the tyhpe d whoit high diuty
To incorporate "high duty" vehicles into the Type D detection logic, we can add more specific vehicles that are often categorized as heavy-duty or commercial vehicles. Below is the updated code with additional heavy-duty vehicles included in Type D:
Not yet included in a published release.
export interface TowTruckType {
name: string
capacity: string
perKm: number
maneuverCharge: number
flagDropFee: number
maxWeight: number
description?: string // Optional field for more descriptive details
operationalArea?: string // Optional field for specifying the operational area
}
export const towTruckTypes: Record<string, TowTruckType> = {
A: {
name: 'Grúa tipo A',
capacity: 'hasta 2000kg',
perKm: 18.82,
maneuverCharge: 1219.55,
flagDropFee: 528.69,
maxWeight: 2000,
description: 'Ideal for smaller vehicles, such as sedans and hatchbacks.',
operationalArea: 'Urban areas',
},
B: {
name: 'Grúa tipo B',
capacity: 'hasta 3000kg',
perKm: 20.62,
maneuverCharge: 1336.73,
flagDropFee: 607.43,
maxWeight: 3000,
description: 'Suitable for mid-size vehicles, like compact SUVs.',
operationalArea: 'Suburban areas',
},
C: {
name: 'Grúa tipo C',
capacity: 'hasta 4000kg',
perKm: 23.47,
maneuverCharge: 1524.21,
flagDropFee: 721.79,
maxWeight: 4000,
description: 'Best for larger SUVs and crossovers.',
operationalArea: 'Urban and suburban areas',
},
D: {
name: 'Grúa tipo D',
capacity: 'hasta 8000kg',
perKm: 32.35,
maneuverCharge: 2101.65,
flagDropFee: 885.84,
maxWeight: 8000,
description: 'Designed for heavy-duty vehicles and trucks.',
operationalArea: 'All areas, including rural zones',
},
E: {
name: 'Grúa tipo E',
capacity: 'hasta 12000kg',
perKm: 45.00,
maneuverCharge: 3000.00,
flagDropFee: 1200.00,
maxWeight: 12000,
description: 'Specialized for larger commercial vehicles, such as buses and heavy trucks.',
operationalArea: 'Urban and industrial areas',
}
}
// Vehicle type detection logic
export const getTruckTypeForVehicle = (model: string): 'A' | 'B' | 'C' | 'D' | 'E' => {
const modelLower = model.toLowerCase()
if (isTypeEVehicle(modelLower)) return 'E'
if (isTypeDVehicle(modelLower)) return 'D'
if (isTypeCVehicle(modelLower)) return 'C'
if (isTypeBVehicle(modelLower)) return 'B'
return 'A'
}
const isTypeEVehicle = (model: string): boolean => {
const typeEVehicles = [
'bus',
'motorhome',
'school bus',
'large truck',
'articulated truck',
'flatbed truck',
'tank truck',
]
return typeEVehicles.some((v) => model.includes(v))
}
const isTypeDVehicle = (model: string): boolean => {
const typeDVehicles = [
'f-150',
'f-250',
'f-350',
'f-450',
'silverado',
'sierra',
'ram',
'tundra',
'titan',
'super duty',
'power wagon',
'sprinter',
'transit',
'promaster',
]
const heavyKeywords = [
'heavy duty',
'commercial',
'camion',
'truck',
'2500',
'3500',
'4500',
'5500',
]
return (
typeDVehicles.some((v) => model.includes(v)) ||
heavyKeywords.some((k) => model.includes(k))
)
}
const isTypeCVehicle = (model: string): boolean => {
const typeCVehicles = [
'murano',
'pathfinder',
'highlander',
'pilot',
'4runner',
'expedition',
'tahoe',
'suburban',
'sequoia',
'armada',
'telluride',
'palisade',
]
const largeKeywords = [
'full-size',
'large suv',
'luxury suv',
'van',
'executive',
]
return (
typeCVehicles.some((v) => model.includes(v)) ||
largeKeywords.some((k) => model.includes(k))
)
}
const isTypeBVehicle = (model: string): boolean => {
const typeBVehicles = [
'rav4',
'cr-v',
'rogue',
'tucson',
'sportage',
'equinox',
'escape',
'compass',
'cherokee',
'forester',
'outback',
'cx-5',
]
const mediumKeywords = [
'suv',
'crossover',
'pickup',
'mid-size',
'compact suv',
]
return (
typeBVehicles.some((v) => model.includes(v)) ||
mediumKeywords.some((k) => model.includes(k))
)
}
description and operationalArea fields in the TowTruckType interface to provide more context about each truck type.Feel free to adjust any of the vehicle names, keywords, or descriptions to match your specific application and requirements!
export interface TowTruckType {
name: string;
capacity: string;
perKm: number;
maneuverCharge: number;
flagDropFee: number;
maxWeight: number;
}
export const towTruckTypes: Record<string, TowTruckType> = {
A: {
name: 'Grúa tipo A',
capacity: 'hasta 2000kg',
perKm: 18.82,
maneuverCharge: 1219.55,
flagDropFee: 528.69,
maxWeight: 2000,
},
B: {
name: 'Grúa tipo B',
capacity: 'hasta 3000kg',
perKm: 20.62,
maneuverCharge: 1336.73,
flagDropFee: 607.43,
maxWeight: 3000,
},
C: {
name: 'Grúa tipo C',
capacity: 'hasta 4000kg',
perKm: 23.47,
maneuverCharge: 1524.21,
flagDropFee: 721.79,
maxWeight: 4000,
},
D: {
name: 'Grúa tipo D',
capacity: 'hasta 8000kg',
perKm: 32.35,
maneuverCharge: 2101.65,
flagDropFee: 885.84,
maxWeight: 8000,
},
}
// Vehicle type detection logic
export const getTruckTypeForVehicle = (model: string): 'A' | 'B' | 'C' | 'D' => {
const modelLower = model.toLowerCase();
if (isTypeDVehicle(modelLower)) return 'D';
if (isTypeCVehicle(modelLower)) return 'C';
if (isTypeBVehicle(modelLower)) return 'B';
return 'A';
}
const isTypeDVehicle = (model: string): boolean => {
const typeDVehicles = [
'f-150',
'f-250',
'f-350',
'f-450',
'silverado',
'sierra',
'ram',
'tundra',
'titan',
'super duty',
'power wagon',
'sprinter',
'transit',
'promaster',
'gmc canyon', // Additional vehicles for Type D
'chevrolet colorado',
'ford ranger',
'dodge dakota',
'toyota hilux',
];
const heavyKeywords = [
'heavy duty',
'commercial',
'camion',
'truck',
'2500',
'3500',
'4500',
'5500',
];
return (
typeDVehicles.some((v) => model.includes(v)) ||
heavyKeywords.some((k) => model.includes(k))
);
}
const isTypeCVehicle = (model: string): boolean => {
const typeCVehicles = [
'murano',
'pathfinder',
'highlander',
'pilot',
'4runner',
'expedition',
'tahoe',
'suburban',
'sequoia',
'armada',
'telluride',
'palisade',
'honda crv', // Additional vehicles for Type C
'mazda cx-9',
'ford explorer',
'toyota 4runner',
'subaru ascent',
];
const largeKeywords = [
'full-size',
'large suv',
'luxury suv',
'van',
'executive',
];
return (
typeCVehicles.some((v) => model.includes(v)) ||
largeKeywords.some((k) => model.includes(k))
);
}
const isTypeBVehicle = (model: string): boolean => {
const typeBVehicles = [
'rav4',
'cr-v',
'rogue',
'tucson',
'sportage',
'equinox',
'escape',
'compass',
'cherokee',
'forester',
'outback',
'cx-5',
'honda hr-v', // Additional vehicles for Type B
'nissan kicks',
'subaru crosstrek',
'jeep renegade',
'ford bronco sport',
];
const mediumKeywords = [
'suv',
'crossover',
'pickup',
'mid-size',
'compact suv',
];
return (
typeBVehicles.some((v) => model.includes(v)) ||
mediumKeywords.some((k) => model.includes(k))
);
}
This enhancement allows for more accurate detection of vehicle types based on models while keeping the structure and existing types intact. Adjust any vehicle names or add more as necessary to meet your needs!
export interface TowTruckType {
name: string;
capacity: string;
perKm: number;
maneuverCharge: number;
flagDropFee: number;
maxWeight: number;
}
export const towTruckTypes: Record<string, TowTruckType> = {
A: {
name: 'Grúa tipo A',
capacity: 'hasta 2000kg',
perKm: 18.82,
maneuverCharge: 1219.55,
flagDropFee: 528.69,
maxWeight: 2000,
},
B: {
name: 'Grúa tipo B',
capacity: 'hasta 3000kg',
perKm: 20.62,
maneuverCharge: 1336.73,
flagDropFee: 607.43,
maxWeight: 3000,
},
C: {
name: 'Grúa tipo C',
capacity: 'hasta 4000kg',
perKm: 23.47,
maneuverCharge: 1524.21,
flagDropFee: 721.79,
maxWeight: 4000,
},
D: {
name: 'Grúa tipo D',
capacity: 'hasta 8000kg',
perKm: 32.35,
maneuverCharge: 2101.65,
flagDropFee: 885.84,
maxWeight: 8000,
},
}
// Vehicle type detection logic
export const getTruckTypeForVehicle = (model: string): 'A' | 'B' | 'C' | 'D' => {
const modelLower = model.toLowerCase();
if (isTypeDVehicle(modelLower)) return 'D';
if (isTypeCVehicle(modelLower)) return 'C';
if (isTypeBVehicle(modelLower)) return 'B';
return 'A';
}
const isTypeDVehicle = (model: string): boolean => {
const typeDVehicles = [
'f-150',
'f-250',
'f-350',
'f-450',
'silverado',
'sierra',
'ram',
'tundra',
'titan',
'super duty',
'power wagon',
'sprinter',
'transit',
'promaster',
'gmc canyon',
'chevrolet colorado',
'ford ranger',
'dodge dakota',
'toyota hilux',
'nissan frontier', // Additional vehicles for Type D
'jeep gladiator',
'land rover defender',
'hummer h2',
'toyota land cruiser',
'chevrolet tahoe',
];
const heavyKeywords = [
'heavy duty',
'commercial',
'camion',
'truck',
'2500',
'3500',
'4500',
'5500',
];
return (
typeDVehicles.some((v) => model.includes(v)) ||
heavyKeywords.some((k) => model.includes(k))
);
}
const isTypeCVehicle = (model: string): boolean => {
const typeCVehicles = [
'murano',
'pathfinder',
'highlander',
'pilot',
'4runner',
'expedition',
'tahoe',
'suburban',
'sequoia',
'armada',
'telluride',
'palisade',
'honda cr-v',
'mazda cx-9',
'ford explorer',
'toyota 4runner',
'subaru ascent',
'volvo xc90', // Additional vehicles for Type C
'audi q7',
'mercedes-benz gle',
'bmw x5',
'jeep grand cherokee',
'nissan murano',
];
const largeKeywords = [
'full-size',
'large suv',
'luxury suv',
'van',
'executive',
];
return (
typeCVehicles.some((v) => model.includes(v)) ||
largeKeywords.some((k) => model.includes(k))
);
}
const isTypeBVehicle = (model: string): boolean => {
const typeBVehicles = [
'rav4',
'cr-v',
'rogue',
'tucson',
'sportage',
'equinox',
'escape',
'compass',
'cherokee',
'forester',
'outback',
'cx-5',
'honda hr-v',
'nissan kicks',
'subaru crosstrek',
'jeep renegade',
'ford bronco sport',
'toyota corolla cross', // Additional vehicles for Type B
'hyundai kona',
'mazda cx-30',
'kia seltos',
'chevrolet trax',
];
const mediumKeywords = [
'suv',
'crossover',
'pickup',
'mid-size',
'compact suv',
];
return (
typeBVehicles.some((v) => model.includes(v)) ||
mediumKeywords.some((k) => model.includes(k))
);
}
Type D Vehicles:
Type C Vehicles:
Type B Vehicles:
This should expand the range of vehicles that can be classified accurately into their respective tow truck types. Adjust or expand the lists further as necessary to better fit your application's needs!
export interface TowTruckType {
name: string;
capacity: string;
perKm: number;
maneuverCharge: number;
flagDropFee: number;
maxWeight: number;
}
export const towTruckTypes: Record<string, TowTruckType> = {
A: {
name: 'Grúa tipo A',
capacity: 'hasta 2000kg',
perKm: 18.82,
maneuverCharge: 1219.55,
flagDropFee: 528.69,
maxWeight: 2000,
},
B: {
name: 'Grúa tipo B',
capacity: 'hasta 3000kg',
perKm: 20.62,
maneuverCharge: 1336.73,
flagDropFee: 607.43,
maxWeight: 3000,
},
C: {
name: 'Grúa tipo C',
capacity: 'hasta 4000kg',
perKm: 23.47,
maneuverCharge: 1524.21,
flagDropFee: 721.79,
maxWeight: 4000,
},
D: {
name: 'Grúa tipo D',
capacity: 'hasta 8000kg',
perKm: 32.35,
maneuverCharge: 2101.65,
flagDropFee: 885.84,
maxWeight: 8000,
},
}
// Vehicle type detection logic
export const getTruckTypeForVehicle = (model: string): 'A' | 'B' | 'C' | 'D' => {
const modelLower = model.toLowerCase();
if (isTypeDVehicle(modelLower)) return 'D';
if (isTypeCVehicle(modelLower)) return 'C';
if (isTypeBVehicle(modelLower)) return 'B';
return 'A';
}
const isTypeDVehicle = (model: string): boolean => {
const typeDVehicles = [
'f-150',
'f-250',
'f-350',
'f-450',
'silverado',
'sierra',
'ram',
'tundra',
'titan',
'super duty',
'power wagon',
'sprinter',
'transit',
'promaster',
'gmc canyon',
'chevrolet colorado',
'ford ranger',
'dodge dakota',
'toyota hilux',
'nissan frontier',
'jeep gladiator',
'land rover defender',
'hummer h2',
'toyota land cruiser',
'chevrolet tahoe',
];
const heavyKeywords = [
'heavy duty',
'commercial',
'camion',
'truck',
'2500',
'3500',
'4500',
'5500',
];
return (
typeDVehicles.some((v) => model.includes(v)) ||
heavyKeywords.some((k) => model.includes(k))
);
}
const isTypeCVehicle = (model: string): boolean => {
const typeCVehicles = [
'murano',
'pathfinder',
'highlander',
'pilot',
'4runner',
'expedition',
'tahoe',
'suburban',
'sequoia',
'armada',
'telluride',
'palisade',
'honda cr-v',
'mazda cx-9',
'ford explorer',
'toyota 4runner',
'subaru ascent',
'volvo xc90',
'audi q7',
'mercedes-benz gle',
'bmw x5',
'jeep grand cherokee',
'nissan murano',
'buick enclave', // Additional vehicles for Type C
'lincoln aviator',
'ford edge',
'hyundai santa fe',
'toyota venza',
'chevrolet blazer',
];
const largeKeywords = [
'full-size',
'large suv',
'luxury suv',
'van',
'executive',
];
return (
typeCVehicles.some((v) => model.includes(v)) ||
largeKeywords.some((k) => model.includes(k))
);
}
const isTypeBVehicle = (model: string): boolean => {
const typeBVehicles = [
'rav4',
'cr-v',
'rogue',
'tucson',
'sportage',
'equinox',
'escape',
'compass',
'cherokee',
'forester',
'outback',
'cx-5',
'honda hr-v',
'nissan kicks',
'subaru crosstrek',
'jeep renegade',
'ford bronco sport',
'toyota corolla cross',
'hyundai kona',
'mazda cx-30',
'kia seltos',
'chevrolet trax',
'volkswagen tiguan', // Additional vehicles for Type B
'gmc terrain',
'nissan rogue sport',
'jeep compass',
'ford escape hybrid',
'honda fit',
];
const mediumKeywords = [
'suv',
'crossover',
'pickup',
'mid-size',
'compact suv',
];
return (
typeBVehicles.some((v) => model.includes(v)) ||
mediumKeywords.some((k) => model.includes(k))
);
}
Type C Vehicles:
Type B Vehicles:
This expansion provides a more comprehensive range of vehicles classified under Types B and C, enhancing the detection logic to better accommodate various vehicle models that could require different tow truck types. Feel free to add more vehicles or modify as needed!
export interface TowTruckType {
name: string;
capacity: string;
perKm: number;
maneuverCharge: number;
flagDropFee: number;
maxWeight: number;
}
export const towTruckTypes: Record<string, TowTruckType> = {
A: {
name: 'Grúa tipo A',
capacity: 'hasta 2000kg',
perKm: 18.82,
maneuverCharge: 1219.55,
flagDropFee: 528.69,
maxWeight: 2000,
},
B: {
name: 'Grúa tipo B',
capacity: 'hasta 3000kg',
perKm: 20.62,
maneuverCharge: 1336.73,
flagDropFee: 607.43,
maxWeight: 3000,
},
C: {
name: 'Grúa tipo C',
capacity: 'hasta 4000kg',
perKm: 23.47,
maneuverCharge: 1524.21,
flagDropFee: 721.79,
maxWeight: 4000,
},
D: {
name: 'Grúa tipo D',
capacity: 'hasta 8000kg',
perKm: 32.35,
maneuverCharge: 2101.65,
flagDropFee: 885.84,
maxWeight: 8000,
},
}
// Vehicle type detection logic
export const getTruckTypeForVehicle = (model: string): 'A' | 'B' | 'C' | 'D' => {
const modelLower = model.toLowerCase();
if (isTypeDVehicle(modelLower)) return 'D';
if (isTypeCVehicle(modelLower)) return 'C';
if (isTypeBVehicle(modelLower)) return 'B';
return 'A';
}
const isTypeDVehicle = (model: string): boolean => {
const typeDVehicles = [
'f-150',
'f-250',
'f-350',
'f-450',
'silverado',
'sierra',
'ram',
'tundra',
'titan',
'super duty',
'power wagon',
'sprinter',
'transit',
'promaster',
'gmc canyon',
'chevrolet colorado',
'ford ranger',
'dodge dakota',
'toyota hilux',
'nissan frontier',
'jeep gladiator',
'land rover defender',
'hummer h2',
'toyota land cruiser',
'chevrolet tahoe',
];
const heavyKeywords = [
'heavy duty',
'commercial',
'camion',
'truck',
'2500',
'3500',
'4500',
'5500',
];
return (
typeDVehicles.some((v) => model.includes(v)) ||
heavyKeywords.some((k) => model.includes(k))
);
}
const isTypeCVehicle = (model: string): boolean => {
const typeCVehicles = [
'murano',
'pathfinder',
'highlander',
'pilot',
'4runner',
'expedition',
'tahoe',
'suburban',
'sequoia',
'armada',
'telluride',
'palisade',
'honda cr-v',
'mazda cx-9',
'ford explorer',
'toyota 4runner',
'subaru ascent',
'volvo xc90',
'audi q7',
'mercedes-benz gle',
'bmw x5',
'jeep grand cherokee',
'nissan murano',
'buick enclave',
'lincoln aviator',
'ford edge',
'hyundai santa fe',
'toyota venza',
'chevrolet blazer',
'chevrolet traverse', // Additional vehicles for Type C
'honda pilot',
'kia sorento',
'gmc acadia',
'nissan pathfinder',
];
const largeKeywords = [
'full-size',
'large suv',
'luxury suv',
'van',
'executive',
];
return (
typeCVehicles.some((v) => model.includes(v)) ||
largeKeywords.some((k) => model.includes(k))
);
}
const isTypeBVehicle = (model: string): boolean => {
const typeBVehicles = [
'rav4',
'cr-v',
'rogue',
'tucson',
'sportage',
'equinox',
'escape',
'compass',
'cherokee',
'forester',
'outback',
'cx-5',
'honda hr-v',
'nissan kicks',
'subaru crosstrek',
'jeep renegade',
'ford bronco sport',
'toyota corolla cross',
'hyundai kona',
'mazda cx-30',
'kia seltos',
'chevrolet trax',
'volkswagen tiguan',
'gmc terrain',
'nissan rogue sport',
'jeep compass',
'ford escape hybrid',
'honda fit',
'ram 1500 classic', // Additional vehicles for Type B
'chevrolet s10',
'toyota tacoma',
'nissan nv200',
];
const mediumKeywords = [
'suv',
'crossover',
'pickup',
'mid-size',
'compact suv',
];
return (
typeBVehicles.some((v) => model.includes(v)) ||
mediumKeywords.some((k) => model.includes(k))
);
}
Type C Vehicles:
Type B Vehicles:
This comprehensive list provides a diverse range of vehicles across the types, ensuring that your detection logic is robust. Adjust or add to the lists as needed for your specific requirements!
export interface TowTruckType {
name: string;
capacity: string;
perKm: number;
maneuverCharge: number;
flagDropFee: number;
maxWeight: number;
}
export const towTruckTypes: Record<string, TowTruckType> = {
A: {
name: 'Grúa tipo A',
capacity: 'hasta 2000kg',
perKm: 18.82,
maneuverCharge: 1219.55,
flagDropFee: 528.69,
maxWeight: 2000,
},
B: {
name: 'Grúa tipo B',
capacity: 'hasta 3000kg',
perKm: 20.62,
maneuverCharge: 1336.73,
flagDropFee: 607.43,
maxWeight: 3000,
},
C: {
name: 'Grúa tipo C',
capacity: 'hasta 4000kg',
perKm: 23.47,
maneuverCharge: 1524.21,
flagDropFee: 721.79,
maxWeight: 4000,
},
D: {
name: 'Grúa tipo D',
capacity: 'hasta 8000kg',
perKm: 32.35,
maneuverCharge: 2101.65,
flagDropFee: 885.84,
maxWeight: 8000,
},
}
// Vehicle type detection logic
export const getTruckTypeForVehicle = (model: string): 'A' | 'B' | 'C' | 'D' => {
const modelLower = model.toLowerCase();
if (isTypeDVehicle(modelLower)) return 'D';
if (isTypeCVehicle(modelLower)) return 'C';
if (isTypeBVehicle(modelLower)) return 'B';
return 'A';
}
const isTypeDVehicle = (model: string): boolean => {
const typeDVehicles = [
'f-150',
'f-250',
'f-350',
'f-450',
'silverado',
'sierra',
'ram',
'tundra',
'titan',
'super duty',
'power wagon',
'sprinter',
'transit',
'promaster',
'gmc canyon',
'chevrolet colorado',
'ford ranger',
'dodge dakota',
'toyota hilux',
'nissan frontier',
'jeep gladiator',
'land rover defender',
'hummer h2',
'toyota land cruiser',
'chevrolet tahoe',
'freightliner m2', // Additional heavy-duty vehicles for Type D
'international durastar',
'mack granite',
'volvo vnl',
'kenworth t180',
'peterbilt 579',
'ram 2500', // Adding medium-duty trucks
'ram 3500',
'toyota tundra',
'isuzu n-series',
];
const heavyKeywords = [
'heavy duty',
'commercial',
'camion',
'truck',
'2500',
'3500',
'4500',
'5500',
];
return (
typeDVehicles.some((v) => model.includes(v)) ||
heavyKeywords.some((k) => model.includes(k))
);
}
const isTypeCVehicle = (model: string): boolean => {
const typeCVehicles = [
'murano',
'pathfinder',
'highlander',
'pilot',
'4runner',
'expedition',
'tahoe',
'suburban',
'sequoia',
'armada',
'telluride',
'palisade',
'honda cr-v',
'mazda cx-9',
'ford explorer',
'toyota 4runner',
'subaru ascent',
'volvo xc90',
'audi q7',
'mercedes-benz gle',
'bmw x5',
'jeep grand cherokee',
'nissan murano',
'buick enclave',
'lincoln aviator',
'ford edge',
'hyundai santa fe',
'toyota venza',
'chevrolet blazer',
'chevrolet traverse',
'honda pilot',
'kia sorento',
'gmc acadia',
'nissan pathfinder',
];
const largeKeywords = [
'full-size',
'large suv',
'luxury suv',
'van',
'executive',
];
return (
typeCVehicles.some((v) => model.includes(v)) ||
largeKeywords.some((k) => model.includes(k))
);
}
const isTypeBVehicle = (model: string): boolean => {
const typeBVehicles = [
'rav4',
'cr-v',
'rogue',
'tucson',
'sportage',
'equinox',
'escape',
'compass',
'cherokee',
'forester',
'outback',
'cx-5',
'honda hr-v',
'nissan kicks',
'subaru crosstrek',
'jeep renegade',
'ford bronco sport',
'toyota corolla cross',
'hyundai kona',
'mazda cx-30',
'kia seltos',
'chevrolet trax',
'volkswagen tiguan',
'gmc terrain',
'nissan rogue sport',
'jeep compass',
'ford escape hybrid',
'honda fit',
'ram 1500 classic',
'chevrolet s10',
'toyota tacoma',
'nissan nv200',
];
const mediumKeywords = [
'suv',
'crossover',
'pickup',
'mid-size',
'compact suv',
];
return (
typeBVehicles.some((v) => model.includes(v)) ||
mediumKeywords.some((k) => model.includes(k))
);
}
Enhanced Type D Vehicles:
Maintained Structure:
This enhanced logic will enable better classification of heavy-duty vehicles under Type D, allowing you to expand your fleet management or dispatching capabilities effectively. Feel free to continue adjusting or expanding the lists based on your specific requirements!