Andrew Wallo 8 miesięcy temu
rodzic
commit
ef337188d2

+ 2
- 0
app/Enums/Setting/DocumentType.php Wyświetl plik

@@ -9,6 +9,7 @@ enum DocumentType: string implements HasIcon, HasLabel
9 9
 {
10 10
     case Invoice = 'invoice';
11 11
     case Bill = 'bill';
12
+    case Estimate = 'estimate';
12 13
 
13 14
     public const DEFAULT = self::Invoice->value;
14 15
 
@@ -22,6 +23,7 @@ enum DocumentType: string implements HasIcon, HasLabel
22 23
         return match ($this->value) {
23 24
             self::Invoice->value => 'heroicon-o-document-duplicate',
24 25
             self::Bill->value => 'heroicon-o-clipboard-document-list',
26
+            self::Estimate->value => 'heroicon-o-currency-dollar',
25 27
         };
26 28
     }
27 29
 }

+ 5
- 0
app/Models/Setting/DocumentDefault.php Wyświetl plik

@@ -88,6 +88,11 @@ class DocumentDefault extends Model
88 88
         return $query->scopes(['type' => [DocumentType::Bill]]);
89 89
     }
90 90
 
91
+    public function scopeEstimate(Builder $query): Builder
92
+    {
93
+        return $query->scopes(['type' => [DocumentType::Estimate]]);
94
+    }
95
+
91 96
     public static function availableNumberDigits(): array
92 97
     {
93 98
         return array_combine(range(1, 20), range(1, 20));

+ 6
- 0
database/factories/Setting/CompanyDefaultFactory.php Wyświetl plik

@@ -90,6 +90,12 @@ class CompanyDefaultFactory extends Factory
90 90
             'created_by' => $user->id,
91 91
             'updated_by' => $user->id,
92 92
         ]);
93
+
94
+        DocumentDefault::factory()->estimate()->createQuietly([
95
+            'company_id' => $company->id,
96
+            'created_by' => $user->id,
97
+            'updated_by' => $user->id,
98
+        ]);
93 99
     }
94 100
 
95 101
     private function createLocalization(Company $company, User $user, string $countryCode, string $language): void

+ 8
- 0
database/factories/Setting/DocumentDefaultFactory.php Wyświetl plik

@@ -61,4 +61,12 @@ class DocumentDefaultFactory extends Factory
61 61
     {
62 62
         return $this->state($this->baseState(DocumentType::Bill, 'BILL-', 'Bill'));
63 63
     }
64
+
65
+    /**
66
+     * Indicate that the model's type is estimate.
67
+     */
68
+    public function estimate(): self
69
+    {
70
+        return $this->state($this->baseState(DocumentType::Estimate, 'EST-', 'Estimate'));
71
+    }
64 72
 }

Ładowanie…
Anuluj
Zapisz