mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Add ability to update billable rate of existing time entries
This commit is contained in:
committed by
Gregor Vostrak
parent
7c26cee1ea
commit
2184b3c835
@@ -23,6 +23,7 @@ class MemberFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'billable_rate' => null,
|
||||
'role' => Role::Employee,
|
||||
'organization_id' => Organization::factory(),
|
||||
'user_id' => User::factory(),
|
||||
@@ -68,6 +69,20 @@ class MemberFactory extends Factory
|
||||
});
|
||||
}
|
||||
|
||||
public function billableRate(?int $billableRate): self
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'billable_rate' => $billableRate,
|
||||
]);
|
||||
}
|
||||
|
||||
public function withBillableRate(): self
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'billable_rate' => $this->faker->numberBetween(50, 1000) * 100,
|
||||
]);
|
||||
}
|
||||
|
||||
public function attachToOrganization(Organization $organization, array $pivot = []): static
|
||||
{
|
||||
return $this->afterCreating(function (User $user) use ($organization, $pivot) {
|
||||
|
||||
@@ -23,12 +23,26 @@ class OrganizationFactory extends Factory
|
||||
return [
|
||||
'name' => $this->faker->unique()->company(),
|
||||
'currency' => $this->faker->currencyCode(),
|
||||
'billable_rate' => $this->faker->numberBetween(50, 1000) * 100,
|
||||
'billable_rate' => null,
|
||||
'user_id' => User::factory(),
|
||||
'personal_team' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function billableRate(?int $billableRate): self
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'billable_rate' => $billableRate,
|
||||
]);
|
||||
}
|
||||
|
||||
public function withBillableRate(): self
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'billable_rate' => $this->faker->numberBetween(50, 1000) * 100,
|
||||
]);
|
||||
}
|
||||
|
||||
public function withOwner(?User $owner = null): self
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
|
||||
@@ -40,9 +40,29 @@ class TimeEntryFactory extends Factory
|
||||
'task_id' => null,
|
||||
'project_id' => null,
|
||||
'organization_id' => Organization::factory(),
|
||||
'billable_rate' => null,
|
||||
];
|
||||
}
|
||||
|
||||
public function notBillable(): self
|
||||
{
|
||||
return $this->state(function (array $attributes): array {
|
||||
return [
|
||||
'billable' => false,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public function billableRate(int $billableRate): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($billableRate): array {
|
||||
return [
|
||||
'billable' => true,
|
||||
'billable_rate' => $billableRate,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
public function withTask(Organization $organization): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use (&$organization): array {
|
||||
|
||||
Reference in New Issue
Block a user