Skip to content

Commit

Permalink
created crud of warehouses,products,suppliers
Browse files Browse the repository at this point in the history
  • Loading branch information
TemuulenBM committed Nov 15, 2023
1 parent 8352561 commit 3820ee8
Show file tree
Hide file tree
Showing 85 changed files with 3,642 additions and 2,080 deletions.
106 changes: 104 additions & 2 deletions addon/components/product-form-panel.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="flex flex-row items-center justify-between w-full mb-4">
<div class="flex flex-1 space-x-2">
{{#if this.product.id}}
<Button @type="default" @icon="id-card" @helpText="View product details" @onClick={{this.onViewDetails}} />
<Button @type="default" @icon="box" @helpText="View product details" @onClick={{this.onViewDetails}} />
{{/if}}
</div>
<div class="flex flex-1 justify-end">
Expand Down Expand Up @@ -68,5 +68,107 @@
</div>
</Overlay::Header>

<Overlay::Body @wrapperClass="new-service-rate-overlay-body px-4 pt-4" @increaseInnerBodyHeightBy={{700}} />
<Overlay::Body @wrapperClass="new-service-rate-overlay-body px-4 pt-4" @increaseInnerBodyHeightBy={{700}}>
<div class="w-32 mb-6 mr-6 flex flex-col items-center">
<Image src={{this.product.photo_url}} alt={{this.product.name}} height="128" width="128" class="h-32 w-32 rounded-md" />
<UploadButton @name="photos" @accept="image/*" @onFileAdded={{this.uploadNewPhoto}} class="w-32" />
</div>
<div class="flex-1 space-y-4">
<ContentPanel @title="Details" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-2">
<InputGroup @name="Name" @value={{this.product.name}} @helpText="Name of item or entity." @wrapperClass="mb-2" />
<InputGroup
@name="Internal ID"
@value={{this.product.internal_id}}
@helpText="Use this field to optionally set a custom identifier or internal identifier for the entity."
@wrapperClass="mb-2"
/>
<InputGroup @name="SKU" @value={{this.product.sku}} @helpText="Stock keeping unit number if applicable." @wrapperClass="mb-2" />
<div></div>
<InputGroup @name="Description" @helpText="Additional description text of entity." @wrapperClass="col-span-2 mb-2">
<Textarea @value={{this.product.description}} type="text" class="w-full form-input" placeholder="Description" />
</InputGroup>
</div>
</ContentPanel>

<ContentPanel @title="Pricing & Value" @open={{false}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-2">
<InputGroup @name="Price" @helpText="Price of entity." @wrapperClass="mb-2">
<MoneyInput
class="w-full"
@value={{this.product.price}}
@currency={{this.product.currency}}
@canSelectCurrency={{true}}
@onCurrencyChange={{this.product.currency}}
/>
</InputGroup>
<InputGroup @name="Sale Price" @helpText="Sale price or discounted price of entity." @wrapperClass="mb-2">
<MoneyInput
class="w-full"
@value={{this.product.sale_price}}
@currency={{this.product.currency}}
@canSelectCurrency={{true}}
@onCurrencyChange={{this.product.currency}}
/>
</InputGroup>
<InputGroup @name="Declared Value" @helpText="Declared value of entity, useful is insurable." @wrapperClass="mb-2">
<MoneyInput
class="w-full"
@value={{this.product.declared_value}}
@currency={{this.product.currency}}
@canSelectCurrency={{true}}
@onCurrencyChange={{this.product.currency}}
/>
</InputGroup>
</div>
</ContentPanel>

<ContentPanel @title="Measurements & Weight" @open={{false}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<div class="grid grid-cols-3 gap-1">
<InputGroup @name="Length" @helpText="The length of the entity." @wrapperClass="mb-2">
<UnitInput
class="w-full"
@measurement="length"
@value={{this.product.length}}
@unit={{this.product.dimensions_unit}}
@canSelectUnit={{true}}
@onUnitChange={{fn (mut this.product.dimensions_unit)}}
/>
</InputGroup>
<InputGroup @name="Width" @helpText="The width of the entity." @wrapperClass="mb-2">
<UnitInput
class="w-full"
@measurement="length"
@value={{this.product.width}}
@unit={{this.product.dimensions_unit}}
@canSelectUnit={{true}}
@onUnitChange={{fn (mut this.product.dimensions_unit)}}
/>
</InputGroup>
<InputGroup @name="Height" @helpText="The height of the entity." @wrapperClass="mb-2">
<UnitInput
class="w-full"
@measurement="length"
@value={{this.product.height}}
@unit={{this.product.dimensions_unit}}
@canSelectUnit={{true}}
@onUnitChange={{fn (mut this.product.dimensions_unit)}}
/>
</InputGroup>
</div>
<div class="grid grid-cols-3 gap-1">
<InputGroup @name="Weight" @helpText="The weight of the entity." @wrapperClass="mb-2">
<UnitInput
class="w-full"
@value={{this.product.weight}}
@measurement="weight"
@unit={{this.product.weight_unit}}
@canSelectUnit={{true}}
@onUnitChange={{fn (mut this.product.weight_unit)}}
/>
</InputGroup>
</div>
</ContentPanel>
</div>
</Overlay::Body>
</Overlay>
41 changes: 30 additions & 11 deletions addon/components/product-panel/details.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,52 @@
<div class="grid grid-cols-1 gap-2 lg:grid-cols-2 lg:gap-4 text-xs dark:text-gray-100">

<div class="field-info-container">
<div class="field-name">Website URL</div>
<div class="field-name">Name</div>
<div class="field-value">{{n-a @product.name}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Title</div>
<div class="field-value">{{n-a @product.title}}</div>
<div class="field-name">Internal ID</div>
<div class="field-value">{{n-a @product.internal_id}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Internal ID</div>
<div class="field-value">{{n-a @product.internal_id}}</div>
<div class="field-name">SKU</div>
<div class="field-value">{{n-a @product.sku}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Price</div>
<div class="field-value">{{format-currency @product.price @product.currency}}</div>
</div>
<div class="field-info-container">
<div class="field-name">Sale Price</div>
<div class="field-value">{{format-currency @product.sale_price @product.currency}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Declared Value</div>
<div class="field-value">{{format-currency @product.declared_value @product.currency}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Length</div>
<div class="field-value">{{n-a @product.length}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Email</div>
<div class="field-value">{{n-a @product.email}}</div>
<div class="field-name">Width</div>
<div class="field-value">{{n-a @product.width}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Phone</div>
<div class="field-value">{{n-a @product.phone}}</div>
<div class="field-name">Height</div>
<div class="field-value">{{n-a @product.height}}</div>
</div>

<div class="field-info-container">
<div class="field-name">Type</div>
<div class="field-value"><Badge @status={{@product.type}} /></div>
<div class="field-name">Weight</div>
<div class="field-value">{{n-a @product.weight}}</div>
</div>
</div>
</ContentPanel>
Expand Down
58 changes: 57 additions & 1 deletion addon/components/warehouse-form-panel.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
{{yield}}
<Overlay
@onLoad={{this.setOverlayContext}}
@position="right"
@noBackdrop={{true}}
@fullHeight={{true}}
@isResizeble={{or this.isResizable @isResizable}}
@width={{or this.width @width "600px"}}
>
<Overlay::Header
@title={{if this.warehouse.public_id this.warehouse.name "New Warehouse"}}
@status={{this.warehouse.public_id}}
@hideStatusDot={{true}}
@createdAt={{this.warehouse.createdAt}}
@titleWrapperClass="leading-5"
>
<div class="flex flex-1 justify-end">
<Button @icon={{if this.warehouse.id "save" "check"}} @type="primary" @text={{if this.warehouse.id "Save Warehouse" "Create Warehouse"}} @onClick={{this.save}} @wrapperClass="mr-2" />
<Button @type="default" @icon="times" @helpText={{if this.warehouse.id "Cancel edit warehouse" "Cancel new warehouse"}} @onClick={{this.onPressCancel}} />
</div>
</Overlay::Header>

<Overlay::Body @wrapperClass="new-service-rate-overlay-body px-4 space-y-4 pt-4" @increaseInnerBodyHeightBy={{1000}}>
<div class="grid grid-cols-3 gap-1 text-xs dark:text-gray-100">
<InputGroup @name="Name" @wrapperClass="col-span-2">
<Input @value={{this.warehouse.name}} @type="text" class="w-full form-input" placeholder="Name" />
</InputGroup>
<InputGroup @name="Street 1" @value={{this.warehouse.street1}} @wrapperClass="col-span-3">
<AutocompleteInput @value={{this.warehouse.street1}} @fetchUrl="places/lookup" @onSelect={{this.onAutocomplete}} placeholder="Street 1" class="w-full" as |result|>
{{result.address}}
</AutocompleteInput>
</InputGroup>
<InputGroup @name="Street 2" @autocomplete="nope" @value={{this.warehouse.street2}} @wrapperClass="col-span-3" />
<InputGroup @name="Neighborhood" @autocomplete="nope" @value={{this.warehouse.neighborhood}} />
<InputGroup @name="Building" @autocomplete="nope" @value={{this.warehouse.building}} />
<InputGroup @name="Security Access Code" @autocomplete="nope" @value={{this.warehouse.security_access_code}} />
<InputGroup @name="Postal Code" @autocomplete="nope" @value={{this.warehouse.postal_code}} />
<InputGroup @name="City" @autocomplete="nope" @value={{this.warehouse.city}} />
<InputGroup @name="State" @autocomplete="nope" @value={{this.warehouse.province}} />
<InputGroup @name="Country" @wrapperClass="col-span-2">
<CountrySelect class="w-full form-input form-select form-datalist" @value={{this.warehouse.country}} @onChange={{fn (mut this.warehouse.country)}} warehouseholder="Country" />
</InputGroup>
<InputGroup @name="Coordinates" @wrapperClass="col-span-2">
<CoordinatesInput
@value={{this.warehouse.location}}
@onChange={{this.updateWarehouseCoordinates}}
@onGeocode={{this.onAutocomplete}}
@onUpdatedFromMap={{this.onReverseGeocode}}
@onInit={{this.setCoordinatesInput}}
/>
</InputGroup>
<div class="col-span-1"></div>
<InputGroup @name="Phone">
<PhoneInput @value={{this.warehouse.phone}} @autocomplete="nope" @onInput={{this.phone}} class="form-input w-full" />
</InputGroup>
</div>
</Overlay::Body>
</Overlay>
Loading

0 comments on commit 3820ee8

Please sign in to comment.