Andrew Wallo преди 8 месеца
родител
ревизия
ef337188d2

+ 2
- 0
app/Enums/Setting/DocumentType.php Целия файл

9
 {
9
 {
10
     case Invoice = 'invoice';
10
     case Invoice = 'invoice';
11
     case Bill = 'bill';
11
     case Bill = 'bill';
12
+    case Estimate = 'estimate';
12
 
13
 
13
     public const DEFAULT = self::Invoice->value;
14
     public const DEFAULT = self::Invoice->value;
14
 
15
 
22
         return match ($this->value) {
23
         return match ($this->value) {
23
             self::Invoice->value => 'heroicon-o-document-duplicate',
24
             self::Invoice->value => 'heroicon-o-document-duplicate',
24
             self::Bill->value => 'heroicon-o-clipboard-document-list',
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 Целия файл

88
         return $query->scopes(['type' => [DocumentType::Bill]]);
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
     public static function availableNumberDigits(): array
96
     public static function availableNumberDigits(): array
92
     {
97
     {
93
         return array_combine(range(1, 20), range(1, 20));
98
         return array_combine(range(1, 20), range(1, 20));

+ 6
- 0
database/factories/Setting/CompanyDefaultFactory.php Целия файл

90
             'created_by' => $user->id,
90
             'created_by' => $user->id,
91
             'updated_by' => $user->id,
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
     private function createLocalization(Company $company, User $user, string $countryCode, string $language): void
101
     private function createLocalization(Company $company, User $user, string $countryCode, string $language): void

+ 8
- 0
database/factories/Setting/DocumentDefaultFactory.php Целия файл

61
     {
61
     {
62
         return $this->state($this->baseState(DocumentType::Bill, 'BILL-', 'Bill'));
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
 }

Loading…
Отказ
Запис