-
Notifications
You must be signed in to change notification settings - Fork 0
PC-82: Develop the Form Component for Customer Info page #58
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
Merged
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
64340c4
PC-83: Add Customer Form layout
PivtoranisV 3ea8848
PC-83: add PcInput for improved input handling
PivtoranisV 185bee9
PC-83: Fixed layout for mobile screens
PivtoranisV bf9ef3f
PC-83: Add typeahead for company select
PivtoranisV f0cce3f
PC-84: Add CustomersController and CustomerSerializer with associated…
OGoncharenko 7cf7351
PC-84: Fix linter
OGoncharenko 180a86f
PC-83: Update styles for dropdown menu
PivtoranisV e0cbd32
PC-83: Add arrow down and up icon to the dropdown menu
PivtoranisV ea92670
Merge remote-tracking branch 'origin/PC-90' into PC-82
vb-cmd 9c20925
PC-85 Add company logo component with preview and file upload
vb-cmd 23716af
PC-85 Fix lint and update brakeman
vb-cmd bba8202
PC-85 Refactor test for customer list response
vb-cmd f345b95
PC-85 Add test for customer logo
vb-cmd e6c884e
PC-86: Implement next button logic
PivtoranisV 86abeeb
Merge remote-tracking branch 'origin/PC-82' into PC-82
vb-cmd a9143f5
Merge branch 'PC-77' into PC-82
vb-cmd 7727c50
PC-84: Add customer fetching and validation to CustomerForm component
OGoncharenko 08657e9
PC-84: Try to fix build
OGoncharenko 1671343
PC-84: Try to fix build
OGoncharenko e429320
PC-86: Add specs for upsert action
PivtoranisV a2f259e
PC-83: Refactor styles and structure in CustomerInfo
PivtoranisV d5ce101
PC-85 Move CompanyLogoUploader component to its own file, add logo pa…
vb-cmd 8731555
Merge remote-tracking branch 'origin/PC-82' into PC-82
vb-cmd 1e590c9
PC-85 Fix handleLogoUpload and handleNext in CustomerForm.jsx
vb-cmd 5e2421b
PC-83: Fixed icon position in dropdownSelect
PivtoranisV 78152bf
PC-85: Move function to its own file and fix image preview
vb-cmd a9dc141
PC-84: Sort customers by updated_at
PivtoranisV e064fb4
PC-85: Fix logo attachment and display it
vb-cmd 455a04c
Merge remote-tracking branch 'origin/PC-82' into PC-82
vb-cmd 5ac21be
PC-85: Replace logo with logo_url
vb-cmd b114637
Merge branch 'master' of https://github.com/wahanegi/clever-calculato…
PivtoranisV bf75567
Merge branch 'PC-82' of https://github.com/wahanegi/clever-calculator…
PivtoranisV c6aedd5
Merge branch 'master' into PC-82
vb-cmd 1be9a87
PC-109: Change default cursor
vb-cmd cb4db71
PC-108: Chevron icon overlap with the long entered data in the Compan…
IvanRuskevych edd3cbd
PC-110: Fix logo validation not showing after submission
vb-cmd 1945175
PC-112: Fix bug where the logo doesn't adjust correctly
vb-cmd 7a6fe09
PC-111: Fix bug where chevron icon is not clickable and does not disp…
vb-cmd 1f67d05
PC-82: Fix test
vb-cmd 2bcba02
PC-82: Fix lint
vb-cmd b9f51c2
PC-112: Fix and rename PcLogoUploader.jsx; resolve bug causing incorr…
vb-cmd a306678
PC-113: Fix Next button in CustomerForm.jsx
vb-cmd a05fccd
PC-82: Fix file upload in fetchService.js when file has no name
vb-cmd bd717c6
PC-82: Fix dropdown menu not working when user clicks icon
vb-cmd 07fe925
PC-82: Fix display logo
vb-cmd 2ee4e78
PC-131: Fix bug where clicking the Company input doesn't show the dro…
vb-cmd d554c32
PC-130: Fix bug where Next button becomes enabled after selecting a v…
vb-cmd e20b899
PC-115: Add clear X button to the Company input field
vb-cmd 8474e02
PC-114: Add vertical scroll to the dropdown menu and remove the item …
vb-cmd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| .customer-form { | ||
| max-width: 1120px; | ||
| padding: 31px; | ||
| } | ||
|
|
||
| .image-placeholder { | ||
| max-width: 136px; | ||
| width: 136px; | ||
|
|
||
| label:hover { | ||
| cursor: pointer; | ||
| } | ||
| } | ||
|
|
||
| .client-input { | ||
| max-width: 615px; | ||
| } | ||
|
|
||
| .title-input { | ||
| max-width: 241px; | ||
| } | ||
|
|
||
| @media (max-width: 575px) { | ||
| .title-input { | ||
| max-width: 100%; | ||
| } | ||
| } |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| .border-label { | ||
| position: absolute; | ||
| top: -0.4rem; | ||
| left: 0.8rem; | ||
| background: linear-gradient(to bottom, $light 50%, $white 50%); | ||
| } | ||
|
|
||
| .form-control::placeholder { | ||
| color: $gray; | ||
| } | ||
|
|
||
| textarea { | ||
| resize: none; | ||
| } | ||
|
|
||
| .form-control:focus, | ||
| .form-control:active, | ||
| .form-select:focus, | ||
| .form-select:active { | ||
| box-shadow: none !important; | ||
| background-color: $white !important; | ||
| } | ||
|
|
||
| .form-control:-webkit-autofill, | ||
| .form-select:-webkit-autofill { | ||
| background-color: white !important; | ||
| transition: background-color 5000s ease-in-out 0s; | ||
| } | ||
|
|
||
| .form-control:-webkit-autofill:focus, | ||
| .form-select:-webkit-autofill:focus { | ||
| background-color: white !important; | ||
| } | ||
|
|
||
| .rbt-input-main { | ||
| border: none !important; | ||
| border-radius: 4px; | ||
| } | ||
|
|
||
| .rbt-menu .dropdown-item:hover, | ||
| .rbt-menu .dropdown-item:focus { | ||
| background-color: $light; | ||
| color: $primary; | ||
| } | ||
|
|
||
| .rbt-menu .dropdown-item { | ||
| padding: 6px 12px; | ||
| color: $gray-700; | ||
| } | ||
|
|
||
| .rbt-menu.dropdown-menu.show { | ||
| margin-top: 5px; | ||
| outline: 1px solid $primary; | ||
| border-inline: 5px solid $white; | ||
| width: calc(100% + 2px) !important; | ||
| margin-left: -2px; | ||
| max-height: 185px !important; | ||
| } | ||
|
|
||
| .rbt-highlight-text { | ||
| background-color: $light; | ||
| color: $primary; | ||
| padding: 0; | ||
| } | ||
|
|
||
| .rbt-input-hint { | ||
| color: transparent; | ||
| } | ||
|
|
||
| /** | ||
| *** TYPEAHEAD CUSTOM STYLES for "Customer info" Page *** | ||
| **/ | ||
| .pc-typeahead-customer-info { | ||
| .pc-icon-reserve-place { | ||
| padding-right: 60px; | ||
| } | ||
|
|
||
| .pc-typeahead-controls { | ||
| width: 60px; | ||
| } | ||
|
|
||
| .pc-typeahead-button { | ||
| width: 24px; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| *** LOGO UPLOADER *** | ||
| **/ | ||
| .pc-logo-uploader { | ||
| width: 136px; | ||
| height: 117px; | ||
|
|
||
| &-display { | ||
| width: 130px; | ||
| height: 110px; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| module Api | ||
| module V1 | ||
| class BaseController < ApplicationController | ||
| before_action :authenticate_user! | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| module Api | ||
| module V1 | ||
| class CustomersController < BaseController | ||
| def index | ||
| customers = Customer.order(updated_at: :desc) | ||
| render json: CustomerSerializer.new(customers).serializable_hash, status: :ok | ||
| end | ||
|
|
||
| def upsert | ||
| company_name = customer_params[:company_name].downcase | ||
| customer = Customer.where('LOWER(company_name) = ?', company_name).first_or_initialize | ||
| customer.assign_attributes(customer_params) | ||
|
|
||
| if customer.save | ||
| render json: CustomerSerializer.new(customer).serializable_hash, status: :ok | ||
| else | ||
| render json: ErrorSerializer.new(customer.errors).serializable_hash, status: :unprocessable_entity | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def customer_params | ||
| params.expect(customer: [:company_name, :first_name, :last_name, | ||
| :email, :position, :address, | ||
| :notes, :logo]) | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,16 @@ | ||
| class ApplicationController < ActionController::Base | ||
| allow_browser versions: :modern | ||
|
|
||
| before_action :authenticate_user!, unless: :active_admin_controller? | ||
| before_action :set_active_storage_url_options | ||
|
|
||
| private | ||
|
|
||
| def active_admin_controller? | ||
| is_a?(ActiveAdmin::BaseController) | ||
| end | ||
|
|
||
| def set_active_storage_url_options | ||
| ActiveStorage::Current.url_options = { protocol: request.protocol, host: request.host, port: request.port } | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upsertmight be a typo (I'm not sure what that word means)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rogergraves
upsertis combination ofupdateandinsertwords that is used in SQL. So, here in Customers controller upsert action will create or update the customer (I’m not sure what is better name for this method could be). Here is the linkhttps://www.cockroachlabs.com/blog/sql-upsert/