- Added buttons for assigning diagnosis and starting diagnosis based on job card status in the job card view. - Implemented a modal for assigning technicians for diagnosis, including form validation and technician selection. - Updated routes to include a test route for job cards. - Created a new Blade view for testing inspection inputs. - Developed comprehensive feature tests for the estimate module, including creation, viewing, editing, and validation of estimates. - Added tests for estimate model relationships and statistics calculations. - Introduced a basic feature test for job cards index.
42 lines
1.4 KiB
PHP
42 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Diagnosis;
|
|
use App\Models\JobCard;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Estimate>
|
|
*/
|
|
class EstimateFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'estimate_number' => 'MAIN/EST'.str_pad(fake()->unique()->numberBetween(1, 9999), 4, '0', STR_PAD_LEFT),
|
|
'job_card_id' => JobCard::factory(),
|
|
'diagnosis_id' => Diagnosis::factory(),
|
|
'prepared_by_id' => User::factory(),
|
|
'labor_cost' => fake()->randomFloat(2, 100, 1000),
|
|
'parts_cost' => fake()->randomFloat(2, 50, 500),
|
|
'miscellaneous_cost' => fake()->randomFloat(2, 0, 100),
|
|
'subtotal' => fake()->randomFloat(2, 200, 1500),
|
|
'tax_rate' => 8.25,
|
|
'tax_amount' => fake()->randomFloat(2, 10, 100),
|
|
'discount_amount' => fake()->randomFloat(2, 0, 50),
|
|
'total_amount' => fake()->randomFloat(2, 210, 1600),
|
|
'terms_and_conditions' => fake()->paragraph(),
|
|
'validity_period_days' => fake()->numberBetween(7, 90),
|
|
'notes' => fake()->optional()->paragraph(),
|
|
'internal_notes' => fake()->optional()->paragraph(),
|
|
];
|
|
}
|
|
}
|