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 {
@@ -1631,7 +1635,9 @@ class PackageService {
1631
1635
  readPackage(id) {
1632
1636
  return this.http.get(`${this.url}/${id}`);
1633
1637
  }
1634
- readPackagesByFirearm(firearmId) {
1638
+ readPackagesByFirearm(firearmId, includeGunsmithOnly = false) {
1639
+ if (includeGunsmithOnly)
1640
+ return this.http.get(`${this.env.baseUrl}api/firearms/${firearmId}/packages`, { params: { includeGunsmithOnly: includeGunsmithOnly.toString() } });
1635
1641
  return this.http.get(`${this.env.baseUrl}api/firearms/${firearmId}/packages`);
1636
1642
  }
1637
1643
  savePackage(packagez) {
@@ -1684,26 +1690,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1684
1690
  args: ['env']
1685
1691
  }] }]; } });
1686
1692
 
1687
- class WorkOrderShippingItemService {
1688
- constructor(http, env) {
1693
+ class BaseService {
1694
+ constructor(http) {
1689
1695
  this.http = http;
1690
- this.env = env;
1691
- this.url = `${this.env.baseUrl}api/work-orders`;
1692
1696
  }
1693
- getShippingItems(workOrderId) {
1694
- return this.http.get(`${this.url}/${workOrderId}/shipping-items`);
1697
+ getUrl(...params) {
1698
+ let baseUrl = this.urlSegments[0];
1699
+ for (let i = 0; i < params.length; i++) {
1700
+ baseUrl += `/${params[i]}`;
1701
+ if (this.urlSegments.length > i + 1) {
1702
+ baseUrl += `/${this.urlSegments[i + 1]}`;
1703
+ }
1704
+ }
1705
+ return baseUrl;
1706
+ }
1707
+ getAll(...params) {
1708
+ return this.http.get(this.getUrl(...params));
1695
1709
  }
1696
- getShippingItem(workOrderId, shippingItemId) {
1697
- return this.http.get(`${this.url}/${workOrderId}/shipping-items/${shippingItemId}`);
1710
+ get(...params) {
1711
+ return this.http.get(this.getUrl(...params));
1698
1712
  }
1699
- createShippingItem(workOrderId, shippingItem) {
1700
- return this.http.post(`${this.url}/${workOrderId}/shipping-items`, shippingItem);
1713
+ create(item, ...params) {
1714
+ return this.http.post(this.getUrl(...params), item);
1701
1715
  }
1702
- updateShippingItem(workOrderId, shippingItemId, shippingItem) {
1703
- return this.http.put(`${this.url}/${workOrderId}/shipping-items/${shippingItemId}`, shippingItem);
1716
+ update(item, ...params) {
1717
+ return this.http.put(this.getUrl(...params), item);
1704
1718
  }
1705
- deleteShippingItem(workOrderId, shippingItemId) {
1706
- return this.http.delete(`${this.url}/${workOrderId}/shipping-items/${shippingItemId}`);
1719
+ delete(...params) {
1720
+ return this.http.delete(this.getUrl(...params));
1721
+ }
1722
+ }
1723
+ BaseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1724
+ BaseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseService, providedIn: 'root' });
1725
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: BaseService, decorators: [{
1726
+ type: Injectable,
1727
+ args: [{
1728
+ providedIn: 'root'
1729
+ }]
1730
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
1731
+
1732
+ class WorkOrderShippingItemService extends BaseService {
1733
+ constructor(http, env) {
1734
+ super(http);
1735
+ this.http = http;
1736
+ this.env = env;
1737
+ this.urlSegments = [`${this.env.baseUrl}api/work-orders`, 'shipping-items'];
1707
1738
  }
1708
1739
  }
1709
1740
  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 });
@@ -1718,26 +1749,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1718
1749
  args: ['env']
1719
1750
  }] }]; } });
1720
1751
 
1721
- class WorkOrderDiscountService {
1752
+ class WorkOrderDiscountService extends BaseService {
1722
1753
  constructor(http, env) {
1754
+ super(http);
1723
1755
  this.http = http;
1724
1756
  this.env = env;
1725
- this.url = `${this.env.baseUrl}api/work-orders`;
1726
- }
1727
- getDiscounts(workOrderId) {
1728
- return this.http.get(`${this.url}/${workOrderId}/discounts`);
1729
- }
1730
- getDiscount(workOrderId, discountId) {
1731
- return this.http.get(`${this.url}/${workOrderId}/discounts/${discountId}`);
1732
- }
1733
- createDiscount(workOrderId, discount) {
1734
- return this.http.post(`${this.url}/${workOrderId}/discounts`, discount);
1735
- }
1736
- updateDiscount(workOrderId, discountId, discount) {
1737
- return this.http.put(`${this.url}/${workOrderId}/discounts/${discountId}`, discount);
1738
- }
1739
- deleteDiscount(workOrderId, discountId) {
1740
- return this.http.delete(`${this.url}/${workOrderId}/discounts/${discountId}`);
1757
+ this.urlSegments = [`${this.env.baseUrl}api/work-orders`, 'discounts'];
1741
1758
  }
1742
1759
  }
1743
1760
  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 });
@@ -1777,6 +1794,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1777
1794
  args: ['env']
1778
1795
  }] }]; } });
1779
1796
 
1797
+ class WorkOrderNonInventoryItemService extends BaseService {
1798
+ constructor(http, env) {
1799
+ super(http);
1800
+ this.http = http;
1801
+ this.env = env;
1802
+ this.urlSegments = [`${this.env.baseUrl}api/work-orders`, 'non-inventory-items'];
1803
+ }
1804
+ }
1805
+ 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 });
1806
+ WorkOrderNonInventoryItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderNonInventoryItemService, providedIn: 'root' });
1807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: WorkOrderNonInventoryItemService, decorators: [{
1808
+ type: Injectable,
1809
+ args: [{
1810
+ providedIn: 'root'
1811
+ }]
1812
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
1813
+ type: Inject,
1814
+ args: ['env']
1815
+ }] }]; } });
1816
+
1780
1817
  class PhonePipe {
1781
1818
  transform(value, args) {
1782
1819
  if (value && value.length >= 10) {
@@ -1963,7 +2000,7 @@ class PackageSelectorComponent {
1963
2000
  }
1964
2001
  }
1965
2002
  getPackages() {
1966
- this.packageService.readPackagesByFirearm(this.firearmId)
2003
+ this.packageService.readPackagesByFirearm(this.firearmId, this.gunsmithOnly)
1967
2004
  .subscribe(packages => {
1968
2005
  this.packages = packages;
1969
2006
  if (this.packageForm.controls.package.value) {
@@ -2211,10 +2248,10 @@ class NotificationBarComponent {
2211
2248
  }
2212
2249
  }
2213
2250
  NotificationBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NotificationBarComponent, deps: [{ token: NotificationService }], target: i0.ɵɵFactoryTarget.Component });
2214
- 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] });
2251
+ 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] });
2215
2252
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NotificationBarComponent, decorators: [{
2216
2253
  type: Component,
2217
- 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"] }]
2254
+ 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"] }]
2218
2255
  }], ctorParameters: function () { return [{ type: NotificationService }]; } });
2219
2256
 
2220
2257
  class NotificationModule {
@@ -2253,5 +2290,5 @@ var NotificationType;
2253
2290
  * Generated bundle index. Do not edit.
2254
2291
  */
2255
2292
 
2256
- 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 };
2293
+ 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 };
2257
2294
  //# sourceMappingURL=gunsmith-common.mjs.map