Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev main #1

Merged
merged 28 commits into from
Jan 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ce0cf17
set correct autoload patch
roncodes Oct 10, 2023
6d0de1b
Pallet Main Folder Structure
TemuulenBM Nov 10, 2023
1870085
Audit Models
TemuulenBM Nov 10, 2023
8352561
fixed product details controller
TemuulenBM Nov 10, 2023
3820ee8
created crud of warehouses,products,suppliers
TemuulenBM Nov 15, 2023
ed32db6
added delete_at column on the tables and created supplier
TemuulenBM Nov 16, 2023
ab06ef5
created warehouse tables on database and created purchase and sales o…
TemuulenBM Nov 17, 2023
0219311
created basic structure of inventory and batch
TemuulenBM Nov 21, 2023
9eae4ec
fixed supplier and models
TemuulenBM Nov 22, 2023
89e093b
fixed supplier details component
TemuulenBM Nov 22, 2023
33cb9f2
edited product form panel based on task
TemuulenBM Nov 22, 2023
1744274
updated product
TemuulenBM Nov 23, 2023
82da83e
Warehouse changes
TemuulenBM Nov 24, 2023
cd47a15
Created models
TemuulenBM Nov 27, 2023
332fc46
created layout section
TemuulenBM Nov 28, 2023
97614d2
created bin,racks,aisles section
TemuulenBM Nov 29, 2023
017da90
created resources of Warehouse dependecies and generated createRecord…
TemuulenBM Nov 30, 2023
182738f
Created Dock
TemuulenBM Dec 1, 2023
b38e1f5
update `.gitignore` remove `server_vendor` directory
roncodes Dec 1, 2023
5c9694f
remove `.php-cs-fixer.cache`
roncodes Dec 1, 2023
b18992c
minor tweaks
roncodes Dec 1, 2023
0f14ede
minor tweak to display product in inventory cell
roncodes Dec 1, 2023
4650c3e
created low stock,expired stock pages
TemuulenBM Dec 4, 2023
5c30f6d
edited sales-order table, added column on sales-order-form-panel,crea…
TemuulenBM Dec 5, 2023
2a959e9
completed Product,Sales and Purchases page
TemuulenBM Dec 6, 2023
ab42a92
fixed inventory,sales-order,purchase-order, and product small issues
TemuulenBM Dec 7, 2023
c18c349
created Product Category page
TemuulenBM Dec 8, 2023
9e7592e
Product Category
TemuulenBM Dec 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed supplier and models
TemuulenBM committed Nov 22, 2023
commit 9eae4ec28a6141ed888d1fb4a68eab24b6b6321b
2 changes: 0 additions & 2 deletions addon/components/stock-adjustment-form-panel.hbs
Original file line number Diff line number Diff line change
@@ -62,8 +62,6 @@
</div>
</InputGroup>
<InputGroup @name="Quantity" @type="number" @value={{this.stockAdjustment.quantity}} />
<InputGroup @name="Before Quantity" @type="number" @value={{this.stockAdjustment.before_quantity}} />
<InputGroup @name="After Quantity" @type="number" @value={{this.stockAdjustment.after_quantity}} />
</div>
</Overlay::Body>
</Overlay>
129 changes: 55 additions & 74 deletions addon/components/supplier-form-panel.hbs
Original file line number Diff line number Diff line change
@@ -6,83 +6,64 @@
@isResizeble={{or this.isResizable @isResizable}}
@width={{or this.width @width "600px"}}
>
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i">
<div class="flex flex-row items-center justify-between w-full mb-4">
<div class="flex flex-1 space-x-2">
{{#if this.supplier.id}}
<Button @type="default" @icon="warehouse" @helpText="View supplier details" @onClick={{this.onViewDetails}} />
{{/if}}
</div>
<div class="flex flex-1 justify-end">
<div class="mr-2">
<Button @icon={{if this.supplier.id "save" "check"}} @type="primary" @text={{if this.supplier.id "Save Supplier" "Create Supplier"}} @onClick={{this.save}} />
</div>
<Button @type="default" @icon="times" @helpText={{if this.supplier.id "Cancel edit supplier" "Cancel new supplier"}} @onClick={{this.onPressCancel}} />
</div>
</div>
<div class="flex flex-row justify-between w-full">
<div class="flex flex-col flex-1 w-3/4">
<div class="flex flex-row">
<div class="w-14">
<div class="upload-avatar-overlay w-12 h-12 flex items-center justify-start rounded-lg">
<img src={{this.supplier.logo_url}} alt={{this.supplier.name}} height="48" width="48" class="h-12 w-12 rounded-lg shadow-sm" />
<Attach::Tooltip @class="clean" @animation="scale" @placement="top">
<InputInfo @text="Upload new photo" />
</Attach::Tooltip>
<div class="upload-avatar-button-wrapper rounded-lg">
<UploadButton
@name="photos"
@accept="image/*"
@onFileAdded={{this.onUploadNewPhoto}}
@icon="upload"
@hideButtonText={{true}}
@labelClass="upload-avatar-label-overlay"
class="w-12 btn-reset"
/>
</div>
</div>
</div>
<div class="flex flex-col">
<h1 class="text-gray-900 dark:text-white text-2xl">
{{#if this.supplier.id}}
{{this.supplier.name}}
{{else}}
{{#if this.supplier.name}}
{{this.supplier.name}}
{{else}}
<span>New Supplier</span>
{{/if}}
{{/if}}
</h1>
<div class="-mt-1">
<div class="flex flex-row items-center">
<span class="text-sm dark:text-blue-400 text-blue-600">{{n-a (smart-humanize this.supplier.type)}}</span>
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-end w-1/4">
<Badge @status={{this.supplier.status}} @type="info" @hideStatusDot={{true}} />
</div>
<Overlay::Header
@title={{if this.supplier.public_id this.supplier.name "Add Supplier"}}
@status={{this.supplier.public_id}}
@hideStatusDot={{true}}
@createdAt={{this.supplier.createdAt}}
@titleWrapperClass="leading-5"
>
<div class="flex flex-1 justify-end">
<Button @icon={{if this.supplier.id "save" "check"}} @type="primary" @text={{if this.supplier.id "Save Supplier" "Add Supplier"}} @onClick={{this.save}} @wrapperClass="mr-2" />
{{#if this.supplier.id}}
<Button @type="default" @icon="supplier" @helpText="View supplier details" @onClick={{this.onViewDetails}} @wrapperClass="mr-2" />
{{/if}}
<Button @type="default" @icon="times" @helpText={{if this.supplier.id "Cancel edit supplier" "Cancel add supplier"}} @onClick={{this.onPressCancel}} />
</div>
</Overlay::Header>

<Overlay::Body @wrapperClass="new-service-rate-overlay-body px-4 space-y-4 pt-4" @increaseInnerBodyHeightBy={{1000}}>
{{#if this.isEditing}}
<SupplierFormPanel::EditForm
@supplier={{this.supplier}}
@supplierTypes={{this.supplierTypeOptions}}
@supplierStatusOptions={{this.supplierStatusOptions}}
@onSupplierChanged={{this.onSupplierChanged}}
/>
{{else}}
<SupplierFormPanel::CreateForm
@supplier={{this.supplier}}
@supplierTypes={{this.supplierTypeOptions}}
@supplierStatusOptions={{this.supplierStatusOptions}}
@onSupplierChanged={{this.onSupplierChanged}}
/>
{{/if}}
<div class="grid grid-cols-1 text-xs dark:text-gray-100">
<InputGroup @name="Name" @value={{this.supplier.name}} @helpText="The supplier's name, typically the name of a business." />
<InputGroup @name="Email" @type="email" @value={{this.supplier.email}} @helpText="The supplier's email, this can be used to trigger emails to the supplier." />
<InputGroup @name="Phone" @type="tel" @value={{this.supplier.phone}} @helpText="The supplier's phone #, this can be used to trigger SMS or messages to the supplier." />
<InputGroup @name="Website" @value={{this.supplier.website_url}} @helpText="The supplier's website, optionally add the suppliers website for reference." />
<InputGroup @name="Country">
<CountrySelect class="w-full form-input form-select form-datalist" @value={{this.supplier.country}} @onChange={{fn (mut this.supplier.country)}} placeholder="Country" />
</InputGroup>
<InputGroup @name="Status">
<div class="fleetbase-model-select fleetbase-power-select ember-model-select">
<PowerSelect
@options={{@supplierStatusOptions}}
@selected={{this.supplier.status}}
@onChange={{fn (mut this.supplier.status)}}
@placeholder="Select supplier status"
@triggerClass="form-select form-input"
as |status|
>
{{smart-humanize status}}
</PowerSelect>
</div>
</InputGroup>
<InputGroup @name="Address">
<div class="fleetbase-model-select fleetbase-power-select ember-model-select">
<ModelSelect
@modelName="place"
@selectedModel={{this.supplier.place}}
@placeholder="Select Address"
@triggerClass="form-select form-input"
@infiniteScroll={{false}}
@renderInPlace={{true}}
@onChange={{this.selectSupplierAddress}}
as |model|
>
<div class="flex items-center flex-row justify-between">
<div class="truncate flex-1">{{n-a model.address}}</div>
<Badge @hideStatusDot={{true}} @status="info">{{model.public_id}}</Badge>
</div>
</ModelSelect>
</div>
</InputGroup>
</div>
</Overlay::Body>
</Overlay>
74 changes: 6 additions & 68 deletions addon/components/supplier-form-panel.js
Original file line number Diff line number Diff line change
@@ -4,25 +4,13 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import contextComponentCallback from '../utils/context-component-callback';
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
import getSupplierTypeOptions from '../utils/get-supplier-type-options';
import getSupplierStatusOptions from '../utils/get-supplier-status-options';

export default class SupplierFormPanelComponent extends Component {
/**
* @service store
*/
@service store;

/**
* @service fetch
*/
@service fetch;

/**
* @service currentUser
*/
@service currentUser;

/**
* @service notifications
*/
@@ -56,32 +44,17 @@ export default class SupplierFormPanelComponent extends Component {
@tracked isLoading = false;

/**
* The users supplier instance.
* @type {SupplierModel|IntegratedSupplierModel}
* Fuel Report status
* @type {Array}
*/
@tracked supplier;

/**
* Specific types of suppliers which can be set as the type.
*
* @memberof SupplierFormPanelComponent
*/
@tracked supplierTypeOptions = getSupplierTypeOptions();

/**
* Applicable status options for supplier.
*
* @memberof SupplierFormPanelComponent
*/
@tracked supplierStatusOptions = getSupplierStatusOptions();
@tracked statusOptions = ['draft', 'pending-approval', 'approved', 'rejected', 'revised', 'submitted', 'in-review', 'confirmed', 'processed', 'archived', 'cancelled'];

/**
* Constructs the component and applies initial state.
*/
constructor() {
super(...arguments);
this.supplier = this.args.supplier;
this.isEditing = typeof this.supplier.id === 'string';
applyContextComponentArguments(this);
}

@@ -97,7 +70,7 @@ export default class SupplierFormPanelComponent extends Component {
}

/**
* Saves the supplier changes.
* Saves the fuel report changes.
*
* @action
* @returns {Promise<any>}
@@ -114,7 +87,7 @@ export default class SupplierFormPanelComponent extends Component {
return supplier
.save()
.then((supplier) => {
this.notifications.success(`Supplier (${supplier.displayName}) saved successfully.`);
this.notifications.success(`Supplier saved successfully.`);
contextComponentCallback(this, 'onAfterSave', supplier);
})
.catch((error) => {
@@ -131,42 +104,7 @@ export default class SupplierFormPanelComponent extends Component {
}

/**
* Uploads a new logo for the supplier.
*
* @param {File} file
* @memberof DriverFormPanelComponent
*/
@action onUploadNewPhoto(file) {
this.fetch.uploadFile.perform(
file,
{
path: `uploads/${this.currentUser.companyId}/suppliers/${this.supplier.id}`,
subject_uuid: this.supplier.id,
subject_type: 'supplier',
type: 'supplier_logo',
},
(uploadedFile) => {
this.supplier.setProperties({
logo_uuid: uploadedFile.id,
logo_url: uploadedFile.url,
logo: uploadedFile,
});
}
);
}

/**
* Handle when supplier changed.
*
* @param {SupplierModel} supplier
* @memberof SupplierFormPanelComponent
*/
@action onSupplierChanged(supplier) {
this.supplier = supplier;
}

/**
* View the details of the supplier.
* View the details of the fuel-report.
*
* @action
*/
Loading