gunsmith-common 2.2.6 → 2.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/esm2020/notification/notification-bar/notification-bar.component.mjs +3 -3
  2. package/esm2020/shared/controls/package-selector/package-selector.component.mjs +2 -2
  3. package/esm2020/shared/services/base.service.mjs +43 -0
  4. package/esm2020/shared/services/index.mjs +3 -1
  5. package/esm2020/shared/services/package.service.mjs +4 -2
  6. package/esm2020/shared/services/work-order-discount.service.mjs +5 -18
  7. package/esm2020/shared/services/work-order-non-inventory-item.service.mjs +25 -0
  8. package/esm2020/shared/services/work-order-shipping-item.service.mjs +5 -18
  9. package/esm2020/shared/types/index.mjs +2 -1
  10. package/esm2020/shared/types/package.mjs +2 -1
  11. package/esm2020/shared/types/work-order-non-inventory-item.mjs +3 -0
  12. package/fesm2015/gunsmith-common.mjs +75 -36
  13. package/fesm2015/gunsmith-common.mjs.map +1 -1
  14. package/fesm2020/gunsmith-common.mjs +73 -36
  15. package/fesm2020/gunsmith-common.mjs.map +1 -1
  16. package/gunsmith-common-2.2.8.tgz +0 -0
  17. package/package.json +1 -1
  18. package/shared/services/base.service.d.ts +16 -0
  19. package/shared/services/index.d.ts +2 -0
  20. package/shared/services/package.service.d.ts +1 -1
  21. package/shared/services/work-order-discount.service.d.ts +4 -10
  22. package/shared/services/work-order-non-inventory-item.service.d.ts +11 -0
  23. package/shared/services/work-order-shipping-item.service.d.ts +4 -10
  24. package/shared/types/index.d.ts +1 -0
  25. package/shared/types/package.d.ts +1 -0
  26. package/shared/types/work-order-non-inventory-item.d.ts +8 -0
  27. package/gunsmith-common-2.2.6.tgz +0 -0
@@ -414,6 +414,7 @@ class PackageItem {
414
414
  class Package {
415
415
  constructor() {
416
416
  this.active = true;
417
+ this.gunsmithOnly = false;
417
418
  this.firearms = [];
418
419
  this.items = [];
419
420
  this.optionalItems = [];
@@ -466,6 +467,9 @@ class WorkOrderDiscount {
466
467
  constructor() { }
467
468
  }
468
469
 
470
+ class WorkOrderNonInventoryItem {
471
+ }
472
+
469
473
  function adjustHoliday(finishDate, holidays) {
470
474
  while (holidays.map(h => new Date(h.holiday)).findIndex(h => DateTime.fromJSDate(h) === DateTime.fromJSDate(finishDate)) !== -1) {
471
475
  do {
@@ -1679,7 +1683,9 @@ class PackageService {
1679
1683
  readPackage(id) {
1680
1684
  return this.http.get(`${this.url}/${id}`);
1681
1685
  }
1682
- readPackagesByFirearm(firearmId) {
1686
+ readPackagesByFirearm(firearmId, includeGunsmithOnly = false) {
1687
+ if (includeGunsmithOnly)
1688
+ return this.http.get(`${this.env.baseUrl}api/firearms/${firearmId}/packages`, { params: { includeGunsmithOnly: includeGunsmithOnly.toString() } });
1683
1689
  return this.http.get(`${this.env.baseUrl}api/firearms/${firearmId}/packages`);
1684
1690
  }
1685
1691
  savePackage(packagez) {
@@ -1736,26 +1742,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1736
1742
  }] }];
1737
1743
  } });
1738
1744
 
1739
- class WorkOrderShippingItemService {
1740
- constructor(http, env) {
1745
+ class BaseService {
1746
+ constructor(http) {
1741
1747
  this.http = http;
1742
- this.env = env;
1743
- this.url = `${this.env.baseUrl}api/work-orders`;
1744
1748
  }
1745
- getShippingItems(workOrderId) {
1746
- return this.http.get(`${this.url}/${workOrderId}/shipping-items`);
1749
+ getUrl(...params) {
1750
+ let baseUrl = this.urlSegments[0];
1751
+ for (let i = 0; i < params.length; i++) {
1752
+ baseUrl += `/${params[i]}`;
1753
+ if (this.urlSegments.length > i + 1) {
1754
+ baseUrl += `/${this.urlSegments[i + 1]}`;
1755
+ }
1756
+ }
1757
+ return baseUrl;
1758
+ }
1759
+ getAll(...params) {
1760
+ return this.http.get(this.getUrl(...params));
1747
1761
  }
1748
- getShippingItem(workOrderId, shippingItemId) {
1749
- return this.http.get(`${this.url}/${workOrderId}/shipping-items/${shippingItemId}`);
1762
+ get(...params) {
1763
+ return this.http.get(this.getUrl(...params));
1750
1764
  }
1751
- createShippingItem(workOrderId, shippingItem) {
1752
- return this.http.post(`${this.url}/${workOrderId}/shipping-items`, shippingItem);
1765
+ create(item, ...params) {
1766
+ return this.http.post(this.getUrl(...params), item);
1753
1767
  }
1754
- updateShippingItem(workOrderId, shippingItemId, shippingItem) {
1755
- return this.http.put(`${this.url}/${workOrderId}/shipping-items/${shippingItemId}`, shippingItem);
1768
+ update(item, ...params) {
1769
+ return this.http.put(this.getUrl(...params), item);
1756
1770
  }
1757
- deleteShippingItem(workOrderId, shippingItemId) {
1758
- return this.http.delete(`${this.url}/${workOrderId}/shipping-items/${shippingItemId}`);
1771
+ delete(...params) {
1772
+ return this.http.delete(this.getUrl(...params));
1773
+ }
1774
+ }
1775
+ BaseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1776
+ BaseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseService, providedIn: 'root' });
1777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseService, decorators: [{
1778
+ type: Injectable,
1779
+ args: [{
1780
+ providedIn: 'root'
1781
+ }]
1782
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
1783
+
1784
+ class WorkOrderShippingItemService extends BaseService {
1785
+ constructor(http, env) {
1786
+ super(http);
1787
+ this.http = http;
1788
+ this.env = env;
1789
+ this.urlSegments = [`${this.env.baseUrl}api/work-orders`, 'shipping-items'];
1759
1790
  }
1760
1791
  }
1761
1792
  WorkOrderShippingItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderShippingItemService, deps: [{ token: i1.HttpClient }, { token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1772,26 +1803,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1772
1803
  }] }];
1773
1804
  } });
1774
1805
 
1775
- class WorkOrderDiscountService {
1806
+ class WorkOrderDiscountService extends BaseService {
1776
1807
  constructor(http, env) {
1808
+ super(http);
1777
1809
  this.http = http;
1778
1810
  this.env = env;
1779
- this.url = `${this.env.baseUrl}api/work-orders`;
1780
- }
1781
- getDiscounts(workOrderId) {
1782
- return this.http.get(`${this.url}/${workOrderId}/discounts`);
1783
- }
1784
- getDiscount(workOrderId, discountId) {
1785
- return this.http.get(`${this.url}/${workOrderId}/discounts/${discountId}`);
1786
- }
1787
- createDiscount(workOrderId, discount) {
1788
- return this.http.post(`${this.url}/${workOrderId}/discounts`, discount);
1789
- }
1790
- updateDiscount(workOrderId, discountId, discount) {
1791
- return this.http.put(`${this.url}/${workOrderId}/discounts/${discountId}`, discount);
1792
- }
1793
- deleteDiscount(workOrderId, discountId) {
1794
- return this.http.delete(`${this.url}/${workOrderId}/discounts/${discountId}`);
1811
+ this.urlSegments = [`${this.env.baseUrl}api/work-orders`, 'discounts'];
1795
1812
  }
1796
1813
  }
1797
1814
  WorkOrderDiscountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderDiscountService, deps: [{ token: i1.HttpClient }, { token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1835,6 +1852,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1835
1852
  }] }];
1836
1853
  } });
1837
1854
 
1855
+ class WorkOrderNonInventoryItemService extends BaseService {
1856
+ constructor(http, env) {
1857
+ super(http);
1858
+ this.http = http;
1859
+ this.env = env;
1860
+ this.urlSegments = [`${this.env.baseUrl}api/work-orders`, 'non-inventory-items'];
1861
+ }
1862
+ }
1863
+ WorkOrderNonInventoryItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderNonInventoryItemService, deps: [{ token: i1.HttpClient }, { token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
1864
+ WorkOrderNonInventoryItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderNonInventoryItemService, providedIn: 'root' });
1865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderNonInventoryItemService, decorators: [{
1866
+ type: Injectable,
1867
+ args: [{
1868
+ providedIn: 'root'
1869
+ }]
1870
+ }], ctorParameters: function () {
1871
+ return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
1872
+ type: Inject,
1873
+ args: ['env']
1874
+ }] }];
1875
+ } });
1876
+
1838
1877
  class PhonePipe {
1839
1878
  transform(value, args) {
1840
1879
  if (value && value.length >= 10) {
@@ -2022,7 +2061,7 @@ class PackageSelectorComponent {
2022
2061
  }
2023
2062
  }
2024
2063
  getPackages() {
2025
- this.packageService.readPackagesByFirearm(this.firearmId)
2064
+ this.packageService.readPackagesByFirearm(this.firearmId, this.gunsmithOnly)
2026
2065
  .subscribe(packages => {
2027
2066
  this.packages = packages;
2028
2067
  if (this.packageForm.controls.package.value) {
@@ -2271,10 +2310,10 @@ class NotificationBarComponent {
2271
2310
  }
2272
2311
  }
2273
2312
  NotificationBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NotificationBarComponent, deps: [{ token: NotificationService }], target: i0.ɵɵFactoryTarget.Component });
2274
- NotificationBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NotificationBarComponent, selector: "app-notification-bar", ngImport: i0, template: "<div class=\"notification-bar\" *ngIf=\"messages.length\">\n <div *ngFor=\"let message of viewMessages\" class=\"notification-pill\" [class.error]=\"message.type == 1\" [@fadeOutAnimation]=\"shouldFade()\">\n <i class=\"fa\" [ngClass]=\"getIconClass(message)\"></i> <span class=\"ms-1\">{{message.message}}</span>\n </div>\n <div *ngIf=\"messages.length > 3\" class=\"notification-pill\">{{messages.length - 2}} more...</div>\n</div>\n", styles: [".notification-bar{position:fixed;top:0;left:0;right:0;z-index:10001;pointer-events:none}.notification-bar .notification-pill{max-width:300px;margin:10px auto;border-radius:4px;color:#000;background:rgba(16,16,16,.4);padding:8px;text-align:center}.notification-bar .error{color:#711e16!important;background:rgba(248,216,212,.6)!important}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [fadeOutAnimation] });
2313
+ NotificationBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NotificationBarComponent, selector: "app-notification-bar", ngImport: i0, template: "<div class=\"notification-bar\" *ngIf=\"messages.length\">\n <div *ngFor=\"let message of viewMessages\" class=\"notification-pill\" [class.error]=\"message.type == 1\" [@fadeOutAnimation]=\"shouldFade()\">\n <i class=\"fa\" [ngClass]=\"getIconClass(message)\"></i> <span class=\"ms-1\">{{message.message}}</span>\n </div>\n <div *ngIf=\"messages.length > 3\" class=\"notification-pill\">{{messages.length - 2}} more...</div>\n</div>\n", styles: [".notification-bar{position:fixed;top:0;left:0;right:0;z-index:10001;pointer-events:none}.notification-bar .notification-pill{max-width:300px;margin:10px auto;border-radius:4px;color:#000;background:#181818;padding:8px;text-align:center;color:#fff}.notification-bar .error{color:#711e16!important;background:#f8d8d4!important}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [fadeOutAnimation] });
2275
2314
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NotificationBarComponent, decorators: [{
2276
2315
  type: Component,
2277
- args: [{ selector: 'app-notification-bar', animations: [fadeOutAnimation], template: "<div class=\"notification-bar\" *ngIf=\"messages.length\">\n <div *ngFor=\"let message of viewMessages\" class=\"notification-pill\" [class.error]=\"message.type == 1\" [@fadeOutAnimation]=\"shouldFade()\">\n <i class=\"fa\" [ngClass]=\"getIconClass(message)\"></i> <span class=\"ms-1\">{{message.message}}</span>\n </div>\n <div *ngIf=\"messages.length > 3\" class=\"notification-pill\">{{messages.length - 2}} more...</div>\n</div>\n", styles: [".notification-bar{position:fixed;top:0;left:0;right:0;z-index:10001;pointer-events:none}.notification-bar .notification-pill{max-width:300px;margin:10px auto;border-radius:4px;color:#000;background:rgba(16,16,16,.4);padding:8px;text-align:center}.notification-bar .error{color:#711e16!important;background:rgba(248,216,212,.6)!important}\n"] }]
2316
+ args: [{ selector: 'app-notification-bar', animations: [fadeOutAnimation], template: "<div class=\"notification-bar\" *ngIf=\"messages.length\">\n <div *ngFor=\"let message of viewMessages\" class=\"notification-pill\" [class.error]=\"message.type == 1\" [@fadeOutAnimation]=\"shouldFade()\">\n <i class=\"fa\" [ngClass]=\"getIconClass(message)\"></i> <span class=\"ms-1\">{{message.message}}</span>\n </div>\n <div *ngIf=\"messages.length > 3\" class=\"notification-pill\">{{messages.length - 2}} more...</div>\n</div>\n", styles: [".notification-bar{position:fixed;top:0;left:0;right:0;z-index:10001;pointer-events:none}.notification-bar .notification-pill{max-width:300px;margin:10px auto;border-radius:4px;color:#000;background:#181818;padding:8px;text-align:center;color:#fff}.notification-bar .error{color:#711e16!important;background:#f8d8d4!important}\n"] }]
2278
2317
  }], ctorParameters: function () { return [{ type: NotificationService }]; } });
2279
2318
 
2280
2319
  class NotificationModule {
@@ -2313,5 +2352,5 @@ var NotificationType;
2313
2352
  * Generated bundle index. Do not edit.
2314
2353
  */
2315
2354
 
2316
- export { BundleItem, ChangeOrderStatus, Coating, CoatingService, CoatingValue, Configuration, ConfigurationService, Customer, CustomerService, Dealer, DealerContact, DealerCoupon, DealerService, DisableControlDirective, EnumPipe, FileNamePipe, FileUploadService, FilterOptions, Firearm, FirearmSeries, FirearmSeriesOptic, FirearmSeriesService, FirearmService, FrameMaterial, FrameMaterialPipe, GunCaliber, GunPart, GunPartOption, GunPartService, InventoryItem, InventoryService, JFile, Material, MaterialService, MillingDetail, MillingItem, MillingType, MillingTypeService, MountType, NewLinePipe, NotificationBarComponent, NotificationModule, NotificationService, NotificationType, Optic, OpticService, OpticStatus, Package, PackageItem, PackageOptionalItem, PackageSelectorComponent, PackageService, PackageTotal, PackageVariation, PackageVariationOption, PhonePipe, Product, ProductService, ProjectType, PurchaseOrder, PurchaseOrderRefinishItem, PurchaseOrderService, PurchaseOrderStatus, QuickbooksService, RearSightPosition, RefinishCode, RefinishCodeService, RefinishDetail, ReportMillingItem, ReportRefinishItem, SharedModule, ShieldRMSOptions, SightType, State, StateService, StatusHistoryService, Total, TotalItem, TotalsService, UserService, Vendor, VendorContact, VendorService, WaitlistAction, WaitlistCustomerService, WaitlistGun, WaitlistGunPackageDetail, WaitlistHistory, WaitlistItem, WaitlistProjectService, WaitlistService, WaitlistStatus, WorkChangeOrder, WorkHoliday, WorkHolidayService, WorkOrder, WorkOrderAction, WorkOrderDiscount, WorkOrderDiscountService, WorkOrderHistory, WorkOrderInventoryItem, WorkOrderListItem, WorkOrderPackageDetail, WorkOrderRefinishItem, WorkOrderService, WorkOrderShippingItem, WorkOrderShippingItemService, WorkOrderStatus, WorkOrderType, calculateFinishDate, coatingDescriptionValidator, coatingValueValidator, convertEnumToObjectArray, getCoatingValues, getCoatings, hasCoatingDescription, hasCoatingValues, refinishDetailsValidator, touchControls };
2355
+ export { BaseService, BundleItem, ChangeOrderStatus, Coating, CoatingService, CoatingValue, Configuration, ConfigurationService, Customer, CustomerService, Dealer, DealerContact, DealerCoupon, DealerService, DisableControlDirective, EnumPipe, FileNamePipe, FileUploadService, FilterOptions, Firearm, FirearmSeries, FirearmSeriesOptic, FirearmSeriesService, FirearmService, FrameMaterial, FrameMaterialPipe, GunCaliber, GunPart, GunPartOption, GunPartService, InventoryItem, InventoryService, JFile, Material, MaterialService, MillingDetail, MillingItem, MillingType, MillingTypeService, MountType, NewLinePipe, NotificationBarComponent, NotificationModule, NotificationService, NotificationType, Optic, OpticService, OpticStatus, Package, PackageItem, PackageOptionalItem, PackageSelectorComponent, PackageService, PackageTotal, PackageVariation, PackageVariationOption, PhonePipe, Product, ProductService, ProjectType, PurchaseOrder, PurchaseOrderRefinishItem, PurchaseOrderService, PurchaseOrderStatus, QuickbooksService, RearSightPosition, RefinishCode, RefinishCodeService, RefinishDetail, ReportMillingItem, ReportRefinishItem, SharedModule, ShieldRMSOptions, SightType, State, StateService, StatusHistoryService, Total, TotalItem, TotalsService, UserService, Vendor, VendorContact, VendorService, WaitlistAction, WaitlistCustomerService, WaitlistGun, WaitlistGunPackageDetail, WaitlistHistory, WaitlistItem, WaitlistProjectService, WaitlistService, WaitlistStatus, WorkChangeOrder, WorkHoliday, WorkHolidayService, WorkOrder, WorkOrderAction, WorkOrderDiscount, WorkOrderDiscountService, WorkOrderHistory, WorkOrderInventoryItem, WorkOrderListItem, WorkOrderNonInventoryItem, WorkOrderNonInventoryItemService, WorkOrderPackageDetail, WorkOrderRefinishItem, WorkOrderService, WorkOrderShippingItem, WorkOrderShippingItemService, WorkOrderStatus, WorkOrderType, calculateFinishDate, coatingDescriptionValidator, coatingValueValidator, convertEnumToObjectArray, getCoatingValues, getCoatings, hasCoatingDescription, hasCoatingValues, refinishDetailsValidator, touchControls };
2317
2356
  //# sourceMappingURL=gunsmith-common.mjs.map