first commit
This commit is contained in:
BIN
public/.DS_Store
vendored
Normal file
BIN
public/.DS_Store
vendored
Normal file
Binary file not shown.
545
public/assets/css/form-style.css
Normal file
545
public/assets/css/form-style.css
Normal file
@@ -0,0 +1,545 @@
|
||||
.formipay-form, .form-fields-wrapper, .result-wrapper, .formipay-page-break {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
/* margin-bottom: 1em; */
|
||||
}
|
||||
.formipay-form img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.formipay-2-cols {
|
||||
display: grid;
|
||||
grid-template-columns: 65% 35%;
|
||||
gap: 1em;
|
||||
}
|
||||
.formipay-field-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.formipay-hidden-group{
|
||||
display: none;
|
||||
}
|
||||
.formipay-label:not(:has(input)) {
|
||||
font-weight: 600;
|
||||
}
|
||||
.divider-label {
|
||||
font-size: larger;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
span.divider-line {
|
||||
border-top: 1px dashed #ccc;
|
||||
display: block;
|
||||
}
|
||||
.formipay-hidden-element {
|
||||
display: none;
|
||||
}
|
||||
.formipay-input-desc {
|
||||
font-size: smaller;
|
||||
color: #b7b7b7;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.formipay-field-group.preset.select-searchable > select.formipay-input.formipay-select{
|
||||
display: none!important;
|
||||
}
|
||||
.formipay-input:not([type=radio]),
|
||||
.formipay-qty-input {
|
||||
border-radius: .5em!important;
|
||||
border: 1px solid #b7b7b7!important;
|
||||
padding: 12px 14px!important;
|
||||
max-width: 100%;
|
||||
width: unset;
|
||||
}
|
||||
.formipay-input, .formipay-qty-input {
|
||||
font-size: 14px;
|
||||
}
|
||||
span.product-qty-wrapper {
|
||||
display: flex;
|
||||
gap: .5em;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
span.product-qty-wrapper > button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
min-width: unset!important;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0!important;
|
||||
border-radius: 50%;
|
||||
background-color: var(--formipay-button-submit-bg-color);
|
||||
}
|
||||
span.product-qty-wrapper > button svg path {
|
||||
stroke: var(--formipay-button-submit-text-color);
|
||||
}
|
||||
span.product-qty-wrapper > button:disabled {
|
||||
background-color: #efefef;
|
||||
}
|
||||
span.product-qty-wrapper > button:disabled svg path {
|
||||
stroke: #666;
|
||||
}
|
||||
span.product-qty-wrapper > input {
|
||||
height: 40px;
|
||||
width: 40px!important;
|
||||
text-align: center;
|
||||
}
|
||||
span.product-qty-wrapper > input::-webkit-outer-spin-button,
|
||||
span.product-qty-wrapper > input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
span.product-qty-wrapper > input[type=number] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
/** CHOICES */
|
||||
.choices__inner {
|
||||
max-width: 100%;
|
||||
width: unset;
|
||||
display: block;
|
||||
min-height: unset!important;
|
||||
padding: 0!important;
|
||||
border: 1px solid #b7b7b7!important;
|
||||
border-radius: .5em!important;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.choices__list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.choices__list:not(.choices__list--dropdown) {
|
||||
padding: 10px 14px;
|
||||
}
|
||||
|
||||
.choices__list.choices__list--dropdown {
|
||||
margin-top: .5em;
|
||||
border-radius: .5em;
|
||||
}
|
||||
/** END CHOICES */
|
||||
|
||||
.formipay-qty-input {
|
||||
width: 75px!important;
|
||||
text-align: right;
|
||||
}
|
||||
.formipay-asterisk {
|
||||
color: var(--formipay-required-field-sign-color);
|
||||
}
|
||||
.formipay-input-invalid {
|
||||
border: 1px solid var(--formipay-required-field-sign-color)!important;
|
||||
}
|
||||
.formipay-button-error {
|
||||
background-color: var(--formipay-required-field-sign-color)!important;
|
||||
}
|
||||
.formipay-button-success {
|
||||
background-color: var(--formipay-button-submit-bg-color)!important;
|
||||
}
|
||||
.formipay-description {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
.formipay-message {
|
||||
background-color: #efefef!important;
|
||||
border-radius: .5em;
|
||||
padding: 1em;
|
||||
border: 3px dashed #8d8d8d;
|
||||
}
|
||||
.formipay-message p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.formipay-message.formipay-message-success {
|
||||
background-color: #d5eed4!important;
|
||||
color: #4a8a46!important;
|
||||
border-radius: 0.5em;
|
||||
padding: 1em;
|
||||
border: 3px dashed #4a8a46;
|
||||
}
|
||||
.formipay-message.formipay-message-failed {
|
||||
background-color: #fec0c0!important;
|
||||
color: #d82424!important;
|
||||
border-radius: .5em;
|
||||
padding: 1em;
|
||||
border: 3px dashed #d82424;
|
||||
}
|
||||
.formipay-submit-button {
|
||||
border-radius: .5em;
|
||||
padding: .75em 1.5em;
|
||||
background-color: var(--formipay-button-submit-bg-color);
|
||||
color: var(--formipay-button-submit-text-color);
|
||||
border: 2px solid var(--formipay-button-submit-border-color);
|
||||
transition: all .3s;
|
||||
font-size: var(--formipay-step-button-text-size);
|
||||
position: relative;
|
||||
}
|
||||
.formipay-submit-button:hover {
|
||||
background-color: var(--formipay-button-submit-bg-color-hover);
|
||||
color: var(--formipay-button-submit-text-color-hover);
|
||||
border-color: var(--formipay-button-submit-border-color-hover);
|
||||
}
|
||||
.formipay-submit-button:active {
|
||||
background-color: var(--formipay-button-submit-bg-color-active);
|
||||
color: var(--formipay-button-submit-text-color-active);
|
||||
border-color: var(--formipay-button-submit-border-color-active);
|
||||
}
|
||||
.formipay-submit-button[disabled] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.text-danger {
|
||||
font-size: smaller;
|
||||
color: red;
|
||||
}
|
||||
table td, table th, .wp-block-table td, .wp-block-table th {
|
||||
border: unset;
|
||||
}
|
||||
.formipay-item-row th {
|
||||
font-weight: normal;
|
||||
}
|
||||
.formipay-item-row td {
|
||||
text-align: right;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.formipay-total-row td {
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
padding-bottom: .25em;
|
||||
}
|
||||
.formipay-item-row:not(:first-child) {
|
||||
border-top: 1px solid lightgray !important;
|
||||
}
|
||||
.formipay-item-row:not(:first-child) th, .formipay-item-row:not(:first-child) td{
|
||||
padding-top: .15em;
|
||||
}
|
||||
.formipay-item-row:not(:nth-last-child(2)) th, .formipay-item-row:not(:nth-last-child(2)) td{
|
||||
padding-bottom: .15em;
|
||||
}
|
||||
.formipay-total-row {
|
||||
border-top: 1px solid;
|
||||
}
|
||||
.form-calculation {
|
||||
border: 2px dashed;
|
||||
padding: 1em;
|
||||
border-radius: .5em;
|
||||
background-color: #efefef;
|
||||
}
|
||||
span.formipay-value-badge {
|
||||
font-size: small;
|
||||
color: white;
|
||||
background-color: #666;
|
||||
padding: .25em 1em;
|
||||
border-radius: 150px;
|
||||
display: inline-flex;
|
||||
margin-left: .25em;
|
||||
}
|
||||
table#formipay-review-order {
|
||||
border: none;
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
#formipay-review-order td:last-child{
|
||||
text-align: right;
|
||||
padding-top: .25em;
|
||||
padding-bottom: .25em;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
#formipay-review-order th{
|
||||
text-align: left;
|
||||
padding-top: .25em;
|
||||
padding-bottom: .25em;
|
||||
}
|
||||
table#formipay-review-order tr:not(:first-child):not(.formipay-grand-total-row) td,
|
||||
table#formipay-review-order tr:not(:first-child):not(.formipay-grand-total-row) th {
|
||||
border-top: 1px solid grey !important;
|
||||
}
|
||||
table#formipay-review-order .sub {
|
||||
color: #008000;
|
||||
}
|
||||
table#formipay-review-order .add {
|
||||
color: #FF0000;
|
||||
}
|
||||
table#formipay-review-order tr.sub,
|
||||
table#formipay-review-order tr.add,
|
||||
table#formipay-review-order tr.no-context{
|
||||
font-size: small;
|
||||
}
|
||||
.formipay-validate-field {
|
||||
margin-bottom: 0;
|
||||
color: var(--formipay-required-field-sign-color);
|
||||
}
|
||||
.formipay-field-group > label {
|
||||
font-weight: bold;
|
||||
}
|
||||
.formipay-payments {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(var(--formipay-payment-desktop-columns), 1fr);
|
||||
gap: .5em;
|
||||
}
|
||||
.formipay-payment-option-group > label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
height: 40px;
|
||||
}
|
||||
.formipay-payment-option-group > label > .formipay-payment-name {
|
||||
margin-top: auto;
|
||||
}
|
||||
.formipay-payment-option-group > label > .formipay-payment-logo {
|
||||
max-height: 40px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.formipay-payment-option-group {
|
||||
position: relative;
|
||||
border: 2px solid darkgrey;
|
||||
border-radius: 10px;
|
||||
padding: .5em;
|
||||
}
|
||||
.formipay-payment-option-group:has(input:checked) {
|
||||
border-color: var(--formipay-button-submit-bg-color);
|
||||
box-shadow: 0 5px 15px -5px darkgrey;
|
||||
}
|
||||
.formipay-input[type=radio], .formipay-input[type=checkbox] {
|
||||
accent-color: var(--formipay-button-submit-border-color);
|
||||
}
|
||||
.formipay-payment-option-group input {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
}
|
||||
.formipay-payment-logo.payment-logo-only {
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
}
|
||||
.formipay-radio-option-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: .5rem;
|
||||
}
|
||||
.formipay-field-group > p {
|
||||
margin: 0;
|
||||
}
|
||||
.checkbox-image {
|
||||
width: 100%;
|
||||
min-height: 125px;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
background-size: contain;
|
||||
background-position: left;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
tr.formipay-grand-total-row {
|
||||
font-weight: bold;
|
||||
}
|
||||
.formipay-top-pagination {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(var(--formipay-page-break-count), 1fr);
|
||||
}
|
||||
.formipay-progress {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
.formipay-index-wrapper {
|
||||
display: flex;
|
||||
gap: .5em;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.formipay-page-index {
|
||||
font-size: smaller;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 2px solid #a7a7a7;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: var(--formipay-step-shape-radius);
|
||||
color: #a7a7a7;
|
||||
background-color: white;
|
||||
font-weight: bold;
|
||||
flex-shrink: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.formipay-page-label {
|
||||
color: #a7a7a7;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 1.25em;
|
||||
}
|
||||
.formipay-progress.active .formipay-page-index,
|
||||
.formipay-progress:has(~ .active) .formipay-page-index {
|
||||
border-color: var(--formipay-button-submit-bg-color);
|
||||
color: var(--formipay-button-submit-bg-color);
|
||||
}
|
||||
.formipay-progress.active .formipay-page-label,
|
||||
.formipay-progress:has(~ .active) .formipay-page-label {
|
||||
color: var(--formipay-button-submit-bg-color);
|
||||
}
|
||||
.formipay-progress:not(:first-child)::before {
|
||||
content:'';
|
||||
display: block;
|
||||
height: 2px;
|
||||
width: 100%;
|
||||
background-color: #a7a7a7;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.formipay-progress.active:not(:first-child)::before,
|
||||
.formipay-progress:has(~ .active)::before {
|
||||
background-color: var(--formipay-button-submit-bg-color);
|
||||
}
|
||||
#order-details tr:last-child{
|
||||
color: var(--formipay-button-submit-bg-color);
|
||||
background-color: var(--formipay-button-submit-text-color);
|
||||
font-weight: bold;
|
||||
font-size: larger;
|
||||
}
|
||||
span.pagination-icon svg {
|
||||
margin-bottom: -3px;
|
||||
width: 24px!important;
|
||||
height: auto;
|
||||
}
|
||||
.formipay-bottom-pagination {
|
||||
display: flex;
|
||||
justify-content:center;
|
||||
align-items: center;
|
||||
gap: .5em;
|
||||
}
|
||||
.formipay-progress svg path {
|
||||
fill: #a7a7a7!important;
|
||||
}
|
||||
.formipay-progress:has(~ .active) svg path, .formipay-progress.active svg path {
|
||||
fill: var(--formipay-button-submit-bg-color)!important;
|
||||
}
|
||||
.formipay-static-elements .result-wrapper {
|
||||
position: -webkit-sticky; /* for browser compatibility */
|
||||
position: sticky;
|
||||
top: 3em;
|
||||
}
|
||||
.formipay-bottom-pagination > button:not(.formipay-submit-button) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.formipay-page-break-prev-button,
|
||||
.formipay-page-break-next-button {
|
||||
border-radius: .5em!important;
|
||||
padding: var(--formipay-step-button-size)!important;
|
||||
height: var(--formipay-step-button-height)!important;
|
||||
border: 2px solid var(--formipay-button-submit-border-color);
|
||||
background-color: var(--formipay-button-submit-text-color);
|
||||
color: var(--formipay-button-submit-bg-color);
|
||||
font-size: var(--formipay-step-button-text-size);
|
||||
}
|
||||
.formipay-page-break-prev-button:disabled, .formipay-page-break-next-button:disabled {
|
||||
border-color: #a7a7a7;
|
||||
color: #a7a7a7;
|
||||
background-color: #efefef;
|
||||
}
|
||||
.formipay-page-break-prev-button:disabled svg path,
|
||||
.formipay-page-break-next-button:disabled svg path {
|
||||
stroke: #a7a7a7;
|
||||
}
|
||||
.formipay-page-break-prev-button:hover:not(:disabled),
|
||||
.formipay-page-break-prev-button:focus:not(:disabled),
|
||||
.formipay-page-break-next-button:hover:not(:disabled),
|
||||
.formipay-page-break-next-button:focus:not(:disabled) {
|
||||
background-color: var(--formipay-button-submit-bg-color);
|
||||
color: var(--formipay-button-submit-text-color);
|
||||
}
|
||||
.formipay-bottom-pagination > button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: .5em;
|
||||
height: 40px;
|
||||
}
|
||||
.formipay-page-break-prev-button svg path,
|
||||
.formipay-page-break-next-button svg path {
|
||||
stroke: var(--formipay-button-submit-border-color);
|
||||
}
|
||||
.formipay-page-break-prev-button:hover:not(:disabled) svg path,
|
||||
.formipay-page-break-prev-button:focus:not(:disabled) svg path,
|
||||
.formipay-page-break-next-button:hover:not(:disabled) svg path,
|
||||
.formipay-page-break-next-button:focus:not(:disabled) svg path {
|
||||
stroke: var(--formipay-button-submit-text-color);
|
||||
}
|
||||
|
||||
/** Coupon Field */
|
||||
.formipay-coupon-field-group {
|
||||
padding: .25rem;
|
||||
border: 1px solid #b7b7b7!important;
|
||||
border-radius: .5em!important;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
input:active, input:hover, input:focus {
|
||||
outline: unset!important;
|
||||
}
|
||||
.formipay-coupon-field-group .formipay-code-input,
|
||||
.formipay-coupon-field-group .formipay-code-input:hover,
|
||||
.formipay-coupon-field-group .formipay-code-input:active,
|
||||
.formipay-coupon-field-group .formipay-code-input:focus {
|
||||
border: unset!important;
|
||||
outline: unset!important;
|
||||
flex: 0 1 100%;
|
||||
}
|
||||
.formipay-coupon-field-group #apply_coupon_code {
|
||||
width: fit-content;
|
||||
border: unset!important;
|
||||
border-radius: .5em!important;
|
||||
padding: .25rem 1rem;
|
||||
background-color: #333;
|
||||
color: white;
|
||||
}
|
||||
.formipay-coupon-field-group #apply_coupon_code.loading {
|
||||
background-color: #666;
|
||||
color: #cecece;
|
||||
}
|
||||
.formipay-radio-option-group > .formipay-label {
|
||||
display: flex;
|
||||
max-width: 100%;
|
||||
gap: .5rem;
|
||||
align-items: start;
|
||||
}
|
||||
.formipay-radio-option-group > .formipay-label input {
|
||||
margin-top: .25rem;
|
||||
}
|
||||
.formipay-radio-option-group > .formipay-label > span {
|
||||
flex: 0 1 200px;
|
||||
}
|
||||
@media (max-width: 820px) {
|
||||
.formipay-static-elements .result-wrapper {
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
.formipay-checkbox-field-group {
|
||||
grid-template-columns: repeat(2, 1fr)!important;
|
||||
}
|
||||
.formipay-payments {
|
||||
grid-template-columns: repeat(var(--formipay-payment-tablet-columns), 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 482px) {
|
||||
span.formipay-value-badge {
|
||||
font-size: x-small;
|
||||
}
|
||||
.formipay-payments {
|
||||
grid-template-columns: repeat(var(--formipay-payment-mobile-columns), 1fr);
|
||||
}
|
||||
.formipay-2-cols {
|
||||
display: grid;
|
||||
grid-template-columns: 100%;
|
||||
gap: 1em;
|
||||
}
|
||||
.formipay-checkbox-field-group {
|
||||
grid-template-columns: repeat(1, 1fr)!important;
|
||||
}
|
||||
.formipay-page-label {
|
||||
display:none;
|
||||
}
|
||||
.formipay-page-break-information {
|
||||
text-align: center;
|
||||
}
|
||||
button.formipay-submit-button {
|
||||
width: 100%!important;
|
||||
}
|
||||
}
|
||||
33
public/assets/css/payment-confirm.css
Normal file
33
public/assets/css/payment-confirm.css
Normal file
@@ -0,0 +1,33 @@
|
||||
.formipay-container {
|
||||
width: 100%;
|
||||
}
|
||||
.formipay-content-wrapper {
|
||||
width: var(--formipay-confirmation-page-width);
|
||||
max-width: 100%;
|
||||
padding: 1em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: var(--formipay-confirmation-page-table-alignment);
|
||||
}
|
||||
.formipay-content-wrapper > h3,
|
||||
.formipay-cod-confirm-container > p {
|
||||
margin-bottom: unset;
|
||||
}
|
||||
#order-details {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
#order-details th,
|
||||
#order-details td {
|
||||
text-align: left;
|
||||
}
|
||||
#cod_agreement {
|
||||
accent-color: var(--formipay-button-submit-bg-color);
|
||||
}
|
||||
form#formipay-cod-confirmation {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
.swal2-actions > button.formipay-submit-button {
|
||||
width: fit-content!important;
|
||||
}
|
||||
59
public/assets/css/popup-style.css
Normal file
59
public/assets/css/popup-style.css
Normal file
@@ -0,0 +1,59 @@
|
||||
.formipay-popup-trigger {
|
||||
display: flex;
|
||||
}
|
||||
a.formipay-open-popup-button {
|
||||
text-decoration: unset;
|
||||
background-color: var(--formipay-popup-button-bg-color);
|
||||
color: var(--formipay-popup-button-text-color);
|
||||
border: 1px solid var(--formipay-popup-button-border-color);
|
||||
padding: 0.75em 1.5em;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
a.formipay-open-popup-button:hover {
|
||||
background-color: var(--formipay-popup-button-bg-color-hover);
|
||||
color: var(--formipay-popup-button-text-color-hover);
|
||||
border: 1px solid var(--formipay-popup-button-border-color-hover);
|
||||
}
|
||||
a.formipay-open-popup-button:active {
|
||||
background-color: var(--formipay-popup-button-bg-color-active);
|
||||
color: var(--formipay-popup-button-text-color-active);
|
||||
border: 1px solid var(--formipay-popup-button-border-color-active);
|
||||
}
|
||||
.jquery-modal.blocker.current {
|
||||
z-index: 101;
|
||||
}
|
||||
.jquery-modal.blocker.current:has(.formipay-popup) {
|
||||
background-color: var(--formipay-popup-backdrop-color);
|
||||
height: 100svh;
|
||||
}
|
||||
.jquery-modal.blocker.current > .formipay-popup {
|
||||
width: 100%;
|
||||
max-width: var(--formipay-popup-wrapper-width);
|
||||
max-height: 90svh;
|
||||
padding: 0;
|
||||
box-shadow: 0 12px 19px rgb(51, 51, 51, 0.50);
|
||||
-moz-border-radius: 1rem;
|
||||
-o-border-radius: 1rem;
|
||||
-ms-border-radius: 1rem;
|
||||
border-radius: 1rem;
|
||||
-webkit-box-shadow: 0 12px 19px rgb(51, 51, 51, 0.50);
|
||||
-moz-box-shadow: 0 12px 19px rgb(51, 51, 51, 0.50);
|
||||
-o-box-shadow: 0 12px 19px rgb(51, 51, 51, 0.50);
|
||||
-ms-box-shadow: 0 12px 19px rgb(51, 51, 51, 0.50);
|
||||
}
|
||||
.jquery-modal.blocker.current > .formipay-popup > .formipay-form {
|
||||
max-height: 100%;
|
||||
overflow: auto;
|
||||
padding: 15px 30px;
|
||||
border-radius: inherit;
|
||||
}
|
||||
h4.formipay-popup-title {
|
||||
font-weight: bold;
|
||||
margin-bottom: 0;
|
||||
border-bottom: 1px solid lightgrey;
|
||||
}
|
||||
.formipay-popup > .formipay-form {
|
||||
background: white;
|
||||
}
|
||||
291
public/assets/css/thankyou.css
Normal file
291
public/assets/css/thankyou.css
Normal file
@@ -0,0 +1,291 @@
|
||||
body {
|
||||
overflow-x: clip;
|
||||
}
|
||||
.formipay-thank-you {
|
||||
width: 100%;
|
||||
}
|
||||
.formipay-container {
|
||||
max-width: 100%;
|
||||
background-color: var(--formipay-thankyou-container-bg-color);
|
||||
padding: 2em;
|
||||
}
|
||||
.formipay-content-wrapper {
|
||||
width: var(--formipay-thankyou-screen-width);
|
||||
max-width: 100%;
|
||||
/* padding: 1.5em; */
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: var(--formipay-thankyou-table-alignment);
|
||||
background-color: var(--formipay-thankyou-wrapper-bg-color);
|
||||
}
|
||||
.formipay-content-wrapper:not(.downloads) .formipay-the-contents {
|
||||
padding: 2.5em 1.5em 0.25em;
|
||||
}
|
||||
.formipay-content-wrapper.downloads .formipay-the-contents {
|
||||
padding: 0.25em 1.5em;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse !important;
|
||||
border-spacing: 0;
|
||||
border-width: 1px 0 0 1px;
|
||||
margin: 0 0 1.5em;
|
||||
width: 100%;
|
||||
}
|
||||
table td, table th, .wp-block-table td, .wp-block-table th {
|
||||
border: 1px solid rgba(0,0,0,.1);
|
||||
}
|
||||
td {
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
th {
|
||||
text-align: left;
|
||||
}
|
||||
td, th {
|
||||
padding: 8px;
|
||||
}
|
||||
td > p {
|
||||
margin-bottom: .25em;
|
||||
}
|
||||
.formipay-form-wrapper table#order-details,
|
||||
.formipay-form-wrapper table#payment-details,
|
||||
.formipay-form-wrapper table#order-submission-details,
|
||||
.formipay-form-wrapper #uploadForm {
|
||||
width: 500px;
|
||||
margin-left: var(--formipay-thankyou-table-alignment-left);
|
||||
margin-right: var(--formipay-thankyou-table-alignment-right);
|
||||
border: none;
|
||||
}
|
||||
.formipay-form-wrapper table#order-details tr,
|
||||
.formipay-form-wrapper table#payment-details tr,
|
||||
.formipay-form-wrapper table#order-submission-details tr {
|
||||
border: 1px solid #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.formipay-form-wrapper table#order-details th,
|
||||
.formipay-form-wrapper table#payment-details th,
|
||||
.formipay-form-wrapper table#order-submission-details th {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
.formipay-form-wrapper table#order-details td,
|
||||
.formipay-form-wrapper table#payment-details td,
|
||||
.formipay-form-wrapper table#order-submission-details td{
|
||||
text-wrap: wrap;
|
||||
}
|
||||
.formipay-form-wrapper table#order-details td p,
|
||||
.formipay-form-wrapper table#payment-details td p,
|
||||
.formipay-form-wrapper table#order-submission-details td p{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
table#order-details td {
|
||||
text-align: right;
|
||||
vertical-align: top!important;
|
||||
}
|
||||
table#order-details th {
|
||||
width: 50%;
|
||||
text-wrap: wrap;
|
||||
}
|
||||
table#order-submission-details td {
|
||||
text-align: left!important;
|
||||
}
|
||||
table#order-submission-details span.checkbox-span {
|
||||
background-color: var(--formipay-button-submit-bg-color);
|
||||
color: var(--formipay-button-submit-text-color);
|
||||
padding: .25em .75em;
|
||||
border-radius: 10px;
|
||||
font-size: small;
|
||||
}
|
||||
table#payment-details td {
|
||||
text-align: right;
|
||||
}
|
||||
table#payment-details td > p {
|
||||
margin: 0;
|
||||
}
|
||||
.formipay-copy-button {
|
||||
padding: .25em 1em;
|
||||
border-radius: .25em;
|
||||
cursor: pointer;
|
||||
background-color: var(--formipay-button-submit-bg-color);
|
||||
color: var(--formipay-button-submit-text-color);
|
||||
font-size: smaller;
|
||||
}
|
||||
.dropzone-area {
|
||||
border: 2px dashed var(--formipay-button-submit-bg-color);
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
border-radius: 1em;
|
||||
padding: 1em;
|
||||
text-align: center;
|
||||
background-color: var(--formipay-confirm-dropzone-bg-color);
|
||||
min-height: 10rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: .5em;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: var(--formipay-confirm-dropzone-text-color);
|
||||
}
|
||||
.dropzone-area .bi-image {
|
||||
font-size: xx-large;
|
||||
}
|
||||
div#thumbnailPreview img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.formipay-submit-button, .swal2-confirm {
|
||||
border-radius: .5em!important;
|
||||
padding: .75em 1.5em!important;
|
||||
background-color: var(--formipay-button-submit-bg-color) !important;
|
||||
color: var(--formipay-button-submit-text-color) !important;
|
||||
border: 2px solid var(--formipay-button-submit-border-color);
|
||||
transition: all .3s;
|
||||
font-size: var(--formipay-step-button-text-size);
|
||||
}
|
||||
.formipay-submit-button:hover, .swal2-confirm:hover {
|
||||
background-color: var(--formipay-button-submit-bg-color-hover) !important;
|
||||
color: var(--formipay-button-submit-text-color-hover) !important;
|
||||
border-color: var(--formipay-button-submit-border-color-hover);
|
||||
}
|
||||
.formipay-submit-button:active, .swal2-confirm:active {
|
||||
background-color: var(--formipay-button-submit-bg-color-active) !important;
|
||||
color: var(--formipay-button-submit-text-color-active) !important;
|
||||
border-color: var(--formipay-button-submit-border-color-active);
|
||||
}
|
||||
.formipay-submit-button[disabled] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
#upload-transfer-receipt.formipay-submit-button {
|
||||
background-color: var(--formipay-button-submit-bg-color) !important;
|
||||
color: var(--formipay-button-submit-text-color) !important;
|
||||
border: 2px solid var(--formipay-button-submit-border-color);
|
||||
margin-right: var(--formipay-thankyou-table-alignment-right);
|
||||
margin-left: var(--formipay-thankyou-table-alignment-left);
|
||||
}
|
||||
.dropzone-area > p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.payment-response-container, #uploadForm {
|
||||
text-align: var(--formipay-thankyou-table-alignment);
|
||||
}
|
||||
.blockUI.blockMsg.blockElement {
|
||||
border: unset!important;
|
||||
background-color: unset!important;
|
||||
color: white!important;
|
||||
}
|
||||
|
||||
/** receipt **/
|
||||
.receipt {
|
||||
background: linear-gradient(135deg, transparent 5.68px, white 5.69px) top left, linear-gradient(45deg, white 2.8px, transparent 2.81px) top left, linear-gradient(135deg, white 2.8px, transparent 2.81px) bottom left, linear-gradient(45deg, transparent 5.68px, white 5.69px) bottom left;
|
||||
background-repeat: repeat-x;
|
||||
background-size: 12px 4px;
|
||||
padding: 3px 0;
|
||||
}
|
||||
.receipt {
|
||||
filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.1));
|
||||
width: var(--formipay-thankyou-screen-width);
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.receipt > * {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
/** Access Downloads **/
|
||||
.formipay-single-download {
|
||||
display: flex;
|
||||
gap: .75rem;
|
||||
max-width: 100%;
|
||||
padding: 1rem .5rem;
|
||||
}
|
||||
.formipay-download-information {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: .75rem;
|
||||
width: 100%;
|
||||
}
|
||||
.formipay-file-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
}
|
||||
i.bi.formipay-download-icon {
|
||||
font-size: 2rem;
|
||||
}
|
||||
span.formipay-file-size {
|
||||
font-size: .75rem;
|
||||
}
|
||||
.formipay-download-button {
|
||||
text-decoration: none;
|
||||
padding: .5em!important;
|
||||
font-size: smaller;
|
||||
height: fit-content;
|
||||
min-width: 100px;
|
||||
}
|
||||
.formipay-single-download:not(:last-child) {
|
||||
border-bottom: 1px solid var(--wp--preset--color--contrast);
|
||||
}
|
||||
|
||||
/** REQUEST ACCESS **/
|
||||
.formipay-container:has(.formipay-request-access) {
|
||||
min-height: 85svh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.formipay-request-access {
|
||||
width: 600px;
|
||||
padding: 2rem;
|
||||
background-color: white;
|
||||
margin: auto;
|
||||
border-radius: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
.formipay-request-access p {
|
||||
font-size: small;
|
||||
color: #999;
|
||||
margin-top: 0;
|
||||
}
|
||||
.formipay-request-access form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
p.formipay-access-item-description {
|
||||
text-align: left;
|
||||
font-size: small;
|
||||
background-color: #efefef;
|
||||
padding: .5em .5em .5em 1em;
|
||||
border-left: 1px solid var(--formipay-button-submit-bg-color);
|
||||
}
|
||||
.formipay-content-wrapper.receipt.downloads:has(.request-thumbnail) .formipay-the-contents {
|
||||
padding: 2.5em;
|
||||
}
|
||||
|
||||
@media (max-width: 482px) {
|
||||
.formipay-container {
|
||||
padding: 2em 1em;
|
||||
}
|
||||
table tr {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
table tr th {
|
||||
border-bottom: unset;
|
||||
}
|
||||
table tr td {
|
||||
border-top: unset;
|
||||
padding-top: 0;
|
||||
text-align: right;
|
||||
}
|
||||
table#order-details th {
|
||||
width: unset;
|
||||
}
|
||||
.formipay-download-information {
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
/** REQUEST ACCESS */
|
||||
.formipay-request-access {
|
||||
width: unset;
|
||||
max-width: 90%;
|
||||
}
|
||||
}
|
||||
BIN
public/assets/img/cod_default_icon.png
Normal file
BIN
public/assets/img/cod_default_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/assets/img/paypal.png
Normal file
BIN
public/assets/img/paypal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
60
public/assets/js/access-link-request.js
Normal file
60
public/assets/js/access-link-request.js
Normal file
@@ -0,0 +1,60 @@
|
||||
jQuery(function($){
|
||||
|
||||
$('#access-pass').on('input', function(){
|
||||
if($(this).val() == ''){
|
||||
$('#request_access_to_media').prop('disabled', true);
|
||||
}else{
|
||||
$('#request_access_to_media').prop('disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
function IsEmail(email) {
|
||||
if (!email.trim().includes('@') || email.trim().includes(',')) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$('#request_access_to_media').on('submit click', function(e){
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
|
||||
if( formipay_thankyou.access_method == 'magic_link' && IsEmail($('#access-pass').val()) == false){
|
||||
Swal.fire({
|
||||
html: formipay_thankyou.email_validation.error.message,
|
||||
icon: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: formipay_thankyou.ajax_url,
|
||||
data: {
|
||||
action: 'request_access_link',
|
||||
pass: $('#access-pass').val(),
|
||||
method: formipay_thankyou.access_method,
|
||||
order: formipay_thankyou.order_id,
|
||||
_wpnonce: formipay_thankyou.nonce
|
||||
},
|
||||
beforeSend: function() {
|
||||
$this.text('Processing...').prop('disabled', true);
|
||||
},
|
||||
success: function (res) {
|
||||
$this.text('Get Access Link').prop('disabled', false);
|
||||
if(res.action == 'reload'){
|
||||
window.location.reload();
|
||||
}else{
|
||||
Swal.fire({
|
||||
title: res.title,
|
||||
html: res.message,
|
||||
icon: res.icon
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
611
public/assets/js/form-action.js
Normal file
611
public/assets/js/form-action.js
Normal file
@@ -0,0 +1,611 @@
|
||||
jQuery(function($){
|
||||
|
||||
let formipay_form_id = $('[data-form-id]').attr('data-form-id');
|
||||
let formipay = formipay_form.forms[formipay_form_id];
|
||||
|
||||
var select_fields = $('.formipay-input.formipay-select');
|
||||
if(select_fields.length > 0){
|
||||
$.each(select_fields, function(index, field){
|
||||
new Choices('#'+$(field).attr('id'));
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm(input_class) {
|
||||
var valid = true;
|
||||
input_class.each(function () {
|
||||
if ($(this).val() === '') {
|
||||
valid = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return valid;
|
||||
}
|
||||
|
||||
function price_format(nStr) {
|
||||
nStr = parseFloat(nStr).toFixed(formipay.decimal_digits) + '';
|
||||
var x = nStr.split('.');
|
||||
var x1 = x[0];
|
||||
var x2 = x.length > 1 ? formipay.decimal_symbol + x[1] : '';
|
||||
var rgx = /(\d+)(\d{3})/;
|
||||
while (rgx.test(x1)) {
|
||||
x1 = x1.replace(rgx, '$1' + formipay.thousand_separator + '$2');
|
||||
}
|
||||
return formipay.currency + ' ' + x1 + x2;
|
||||
}
|
||||
|
||||
$('.product-price-row').find('td').html(price_format($('#product_price').val()));
|
||||
$('.formipay-payment-option-group:first-child').find('input').trigger('click');
|
||||
|
||||
// PAGE BREAK
|
||||
var page_break = $('.formipay-page-break');
|
||||
if(page_break.length > 0){
|
||||
$.each( $('.formipay-field-group:not(.formipay-page-break)'), function(){
|
||||
var prev_page_break = $(this).prev('.formipay-page-break');
|
||||
$(this).appendTo(prev_page_break);
|
||||
} );
|
||||
var payment_page_break = $('.formipay-page-break.formipay-page-break-payment');
|
||||
$('.result-wrapper').appendTo(payment_page_break);
|
||||
$.each( page_break, function(index, page){
|
||||
if(index > 0){
|
||||
$(page).hide();
|
||||
}
|
||||
index = index + 1;
|
||||
$(page).addClass('formipay-page-'+index);
|
||||
});
|
||||
$('.formipay-page-break-payment .formipay-submit-button').appendTo('.formipay-bottom-pagination').css({
|
||||
'margin-left': 'unset',
|
||||
'margin-right': 'unset'
|
||||
}).hide();
|
||||
}
|
||||
var page_break_progress = $('.formipay-progress');
|
||||
if(page_break_progress.length > 0){
|
||||
// $(page_break_progress[0]).addClass('active');
|
||||
$.each(page_break_progress, function(index, page){
|
||||
if(index == 0){
|
||||
$(page).addClass('active');
|
||||
}
|
||||
index = index + 1;
|
||||
$(page).attr('data-page-number', index);
|
||||
});
|
||||
}
|
||||
|
||||
$('.formipay-progress').on('click', function(){
|
||||
var page_number = $(this).attr('data-page-number');
|
||||
var inputs_in_page = $('.formipay-page-break:visible').find('.formipay-input');
|
||||
var valid_to_continue = check_page_input_invalid(inputs_in_page);
|
||||
|
||||
if(valid_to_continue === false){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($('.formipay-page-'+page_number).hasClass('formipay-page-break-payment')){
|
||||
$('.formipay-page-break-next-button').hide();
|
||||
$('.formipay-page-break-next-button').siblings('.formipay-submit-button').show();
|
||||
}else{
|
||||
$('.formipay-page-break-next-button').show();
|
||||
$('.formipay-page-break-next-button').siblings('.formipay-submit-button').hide();
|
||||
}
|
||||
|
||||
$('.formipay-progress').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.formipay-page-break').hide();
|
||||
$('.formipay-page-'+page_number).show();
|
||||
});
|
||||
|
||||
function check_page_input_invalid(inputs){
|
||||
var invalid_input = 0;
|
||||
inputs.each(function(index, field) {
|
||||
var the_label = $(field).data('label');
|
||||
// $(field).removeAttr('style');
|
||||
$(field).removeClass('formipay-input-invalid')
|
||||
if (!$(field).is(':valid')) {
|
||||
// $(field).attr('style', 'border-color: #d93258!important;');
|
||||
$(field).addClass('formipay-input-invalid');
|
||||
$(field).siblings('.formipay-validate-field').remove();
|
||||
if ($(field).attr('type') == 'select' || $(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if ($(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if ($('[name="' + $(field).attr('name') + '"]:checked').length == 0) {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
}
|
||||
} else if ($(field).attr('name').search('agreement') != -1) {
|
||||
var notice_message = formipay.notice_empty_agreement_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
}
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_text_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(invalid_input > 0){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$('.formipay-page-break-next-button').on('click', function(e){
|
||||
var next_page = $('.formipay-page-break:visible').next('.formipay-page-break');
|
||||
var inputs_in_page = $('.formipay-page-break:visible').find('.formipay-input');
|
||||
|
||||
var valid_to_continue = check_page_input_invalid(inputs_in_page);
|
||||
|
||||
if(valid_to_continue === false){
|
||||
return false;
|
||||
}
|
||||
|
||||
var active_progress = $('.formipay-progress.active');
|
||||
if(next_page.length > 0){
|
||||
active_progress.next('.formipay-progress').addClass('active');
|
||||
active_progress.removeClass('active');
|
||||
if(next_page.hasClass('formipay-page-break-payment')){
|
||||
// $(this).prop('disabled', true);
|
||||
$(this).hide();
|
||||
$(this).siblings('.formipay-submit-button').show();
|
||||
}
|
||||
$('.formipay-page-break:visible').hide();
|
||||
next_page.show();
|
||||
e.target.blur()
|
||||
}
|
||||
$('.formipay-page-break-prev-button').prop('disabled', false);
|
||||
});
|
||||
|
||||
$('.formipay-page-break-prev-button').on('click', function(e){
|
||||
var prev_page = $('.formipay-page-break:visible').prev('.formipay-page-break');
|
||||
var active_progress = $('.formipay-progress.active');
|
||||
if(prev_page.length > 0){
|
||||
active_progress.prev('.formipay-progress').addClass('active');
|
||||
active_progress.removeClass('active');
|
||||
if(prev_page.is('.formipay-page-break:nth-child(2)')){
|
||||
$(this).prop('disabled', true);
|
||||
}
|
||||
$('.formipay-page-break-next-button').show();
|
||||
$('.formipay-page-break-next-button').siblings('.formipay-submit-button').hide();
|
||||
$('.formipay-page-break:visible').hide();
|
||||
prev_page.show();
|
||||
e.target.blur()
|
||||
}
|
||||
$('.formipay-page-break-next-button').prop('disabled', false);
|
||||
});
|
||||
|
||||
$('.formipay-input-calculable, .formipay-qty-input').on('change', function(){
|
||||
var form = $(this).parents('form');
|
||||
set_qty_button();
|
||||
do_calculate(form, 'calculate');
|
||||
});
|
||||
|
||||
function set_qty_button() {
|
||||
var input = $('.formipay-qty-input');
|
||||
var min_val = input.attr('min');
|
||||
var max_val = input.attr('max');
|
||||
|
||||
$('button.qty-min, button.qty-plus').prop('disabled', false);
|
||||
|
||||
if(input.val() == min_val){
|
||||
$('button.qty-min').prop('disabled', true);
|
||||
}
|
||||
if(max_val && input.val() == max_val){
|
||||
$('button.qty-plus').prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
set_qty_button();
|
||||
|
||||
$('button.qty-min').on('click', function(){
|
||||
var value = parseInt($('.formipay-qty-input').val());
|
||||
$('.formipay-qty-input').val(value-1).trigger('change');
|
||||
});
|
||||
|
||||
$('button.qty-plus').on('click', function(){
|
||||
var value = parseInt($('.formipay-qty-input').val());
|
||||
$('.formipay-qty-input').val(value+1).trigger('change');
|
||||
});
|
||||
|
||||
function do_calculate(form, action, condition = 'general'){
|
||||
var form_id = form.data('form-id');
|
||||
var inputs = form.find('.formipay-input');
|
||||
var meta_inputs = form.find('.formipay-meta-input');
|
||||
|
||||
var form_inputs = new FormData();
|
||||
|
||||
form_inputs.append('action', 'formipay_submission');
|
||||
form_inputs.append('nonce', formipay_form.nonce);
|
||||
form_inputs.append('data[qty]', $('.formipay-qty-input').val());
|
||||
form_inputs.append('form_id', form_id);
|
||||
|
||||
var $valid = true; // Initialize as true
|
||||
|
||||
inputs.each(function(index, field) {
|
||||
var the_key = $(field).attr('name');
|
||||
var the_label = $(field).data('label');
|
||||
|
||||
// $(field).removeAttr('style');
|
||||
$(field).removeClass('formipay-input-invalid');
|
||||
|
||||
if (!$(field).is(':valid')) {
|
||||
// $(field).attr('style', 'border-color: #d93258!important;');
|
||||
$(field).siblings('.formipay-validate-field').remove();
|
||||
|
||||
if ($(field).attr('type') == 'select' || $(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
var notice_message;
|
||||
if ($(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if (!$('[name="' + $(field).attr('name') + '"]:checked').length) {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
|
||||
$valid = false; // Set valid to false
|
||||
}
|
||||
} else if ($(field).attr('name').search('agreement') != -1) {
|
||||
var notice_message = formipay.notice_empty_agreement_message;
|
||||
$valid = false; // Set valid to false
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$valid = false; // Set valid to false
|
||||
}
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_text_message;
|
||||
$valid = false; // Set valid to false
|
||||
}
|
||||
|
||||
if($valid == false && action == 'checkout' && condition == 'general'){
|
||||
$(field).addClass('formipay-input-invalid');
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
}
|
||||
|
||||
} else {
|
||||
var the_value;
|
||||
if ($(field).attr('type') == 'checkbox') {
|
||||
var val = [];
|
||||
form.find('[name="' + the_key + '"]:checked').each(function(i, check) {
|
||||
val[i] = $(check).val();
|
||||
});
|
||||
the_value = val;
|
||||
} else if ($(field).attr('type') == 'radio') {
|
||||
the_value = $('[name=' + the_key + ']:checked').val();
|
||||
} else {
|
||||
the_value = $(field).val();
|
||||
}
|
||||
|
||||
if ($(field).attr('type') == 'hidden' || $(field).parent().is(':hidden')) {
|
||||
if ($(field).hasClass('formipay-select')) {
|
||||
form_inputs.append('data[' + the_key + '][value]', the_value);
|
||||
form_inputs.append('data[' + the_key + '][label]', $(field).find('option:selected').attr('data-label'));
|
||||
} else {
|
||||
form_inputs.append('data[' + the_key + ']', the_value);
|
||||
}
|
||||
} else {
|
||||
$(field).siblings('.formipay-validate-field').remove();
|
||||
|
||||
if ($(field).hasClass('formipay-select')) {
|
||||
form_inputs.append('data[' + the_key + '][value]', the_value);
|
||||
form_inputs.append('data[' + the_key + '][label]', $(field).find('option:selected').attr('data-label'));
|
||||
} else {
|
||||
form_inputs.append('data[' + the_key + ']', the_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(meta_inputs.length > 0){
|
||||
$.each(meta_inputs, function(key, field){
|
||||
var the_key = $(field).attr('name');
|
||||
var the_value = $(field).val();
|
||||
form_inputs.append('meta_data[' + the_key + ']', the_value);
|
||||
});
|
||||
}
|
||||
|
||||
if($valid || action == 'calculate') {
|
||||
|
||||
form_inputs.append('purpose', action);
|
||||
|
||||
$.ajax({
|
||||
url: formipay_form.ajax_url,
|
||||
data: form_inputs,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
beforeSend: function() {
|
||||
form.find('.formipay-submit-button').text(formipay.button_processing_text).prop('disabled', true);
|
||||
$(document).trigger('formipayCalculateAjaxBeforeSend', [form, action]);
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
form.find('.formipay-submit-button').text(formipay.button_text).prop('disabled', false);
|
||||
$(document).trigger('formipayCalculateAjaxSuccess', [res, form, action]);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
Swal.fire({
|
||||
title: 'Error!',
|
||||
html: xhr.responseText,
|
||||
icon: 'error',
|
||||
customClass: {
|
||||
confirmButton: 'formipay-button-error'
|
||||
},
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showCloseButton: false,
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('change', '.formipay-input-invalid', function(){
|
||||
if($(this).is(':valid')){
|
||||
$(this).removeClass('formipay-input-invalid');
|
||||
$(this).siblings('.formipay-validate-field').remove();
|
||||
}
|
||||
});
|
||||
|
||||
var forms = $('.formipay-form');
|
||||
if(forms.length > 0){
|
||||
$.each(forms, function(index, form){
|
||||
do_calculate($(form), 'calculate', 'first-load');
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('formipayCalculateAjaxBeforeSend', function(event, form, action) {
|
||||
|
||||
if( action === 'checkout' ){
|
||||
form.find('.formipay-validate-field').remove();
|
||||
var form_id = form.data('form-id');
|
||||
|
||||
$('.formipay-input').removeAttr('style');
|
||||
$('[data-form-id=' + form_id + ']').siblings('.submit-response').html('');
|
||||
$('[data-form-id=' + form_id + ']').siblings('.submit-response').hide();
|
||||
$('[data-form-id=' + form_id + ']').siblings('.submit-response').removeClass('formipay-message-success formipay-message-failed');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('formipayCalculateAjaxSuccess', function(event, res, form, action) {
|
||||
|
||||
if(action == 'calculate') {
|
||||
form.find('.formipay-item-row:not(.formipay-product-row):not(.formipay-total-row):not(.formipay-grand-total-row)').remove();
|
||||
var product_price = res.items[0].subtotal;
|
||||
var grand_total = res.total;
|
||||
form.find('td.product_price').html(price_format(product_price));
|
||||
form.find('td.grand_total').html(price_format(grand_total));
|
||||
var button_text = form.find('.formipay-submit-button').data('button-text');
|
||||
form.find('.formipay-submit-button').html(button_text + ' - ' + price_format(grand_total));
|
||||
$.each(res.items, function(index, item){
|
||||
if(index > 0){
|
||||
var qty = '';
|
||||
if('qty' in item && item.qty > 1){
|
||||
qty = ' x '+item.qty;
|
||||
}
|
||||
$('table#formipay-review-order').find('.formipay-total-row').before(`
|
||||
<tr class="formipay-item-row `+item.context+`">
|
||||
<th>`+item.item+qty+`</th>
|
||||
<td>`+price_format(item.subtotal)+`</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
});
|
||||
}else if(action == 'checkout'){
|
||||
var form_id = form.data('form-id');
|
||||
if(res.success) {
|
||||
if(res.data.response_type == 'notice') {
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').html('Success! ' + res.data.message);
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').addClass('formipay-message-success');
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').show();
|
||||
setTimeout(() => {
|
||||
window.location.href = res.data.url;
|
||||
}, 2500);
|
||||
} else if(res.data.response_type == 'popup') {
|
||||
let timerInterval;
|
||||
Swal.fire({
|
||||
title: 'Success!',
|
||||
html: res.data.message,
|
||||
icon: 'success',
|
||||
timer: 2500,
|
||||
timerProgressBar: true,
|
||||
showConfirmButton: false,
|
||||
willClose: () => {
|
||||
clearInterval(timerInterval);
|
||||
},
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showCloseButton: false,
|
||||
}).then((result) => {
|
||||
if (result.dismiss === Swal.DismissReason.timer) {
|
||||
window.location.href = res.data.url;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if(res.data.response_type == 'notice') {
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').html('Failed! ' + res.data.message);
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').addClass('formipay-message-failed');
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').show();
|
||||
} else if(res.data.response_type == 'popup') {
|
||||
Swal.fire({
|
||||
title: 'Failed!',
|
||||
html: res.data.message,
|
||||
icon: 'error',
|
||||
customClass: {
|
||||
confirmButton: 'formipay-button-error'
|
||||
},
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showCloseButton: false,
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('.formipay-form .formipay-submit-button').on('submit click', function(e) {
|
||||
e.preventDefault();
|
||||
var form = $(this).parents('form');
|
||||
do_calculate(form, 'checkout');
|
||||
});
|
||||
|
||||
$('#apply_coupon_code').on('click', function(e){
|
||||
e.preventDefault();
|
||||
var $thisbutton = $(this);
|
||||
var form = $thisbutton.closest('form');
|
||||
if($('.formipay-code-input').val() !== ''){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: formipay_form.ajax_url,
|
||||
data: {
|
||||
action: 'check_coupon_code',
|
||||
code: $('.formipay-code-input').val(),
|
||||
form: form.data('form-id'),
|
||||
security: formipay_form.frontend_nonce
|
||||
},
|
||||
beforeSend: function() {
|
||||
$thisbutton.addClass('loading').prop('disabled', true);
|
||||
},
|
||||
success: function (res) {
|
||||
if(res.success){
|
||||
$thisbutton
|
||||
.html('<i class="bi bi-check-circle"></i>')
|
||||
.removeClass('loading')
|
||||
.css('background-color', '#008000');
|
||||
}else{
|
||||
$thisbutton
|
||||
.html('<i class="bi bi-exclamation-circle"></i>')
|
||||
.removeClass('loading')
|
||||
.css('background-color', '#FF0000');
|
||||
$('.formipay-code-input').val('');
|
||||
}
|
||||
do_calculate(form, 'calculate');
|
||||
setTimeout(() => {
|
||||
$thisbutton
|
||||
.removeAttr('style')
|
||||
.html($thisbutton.data('text'))
|
||||
.prop('disabled', false);
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const $phoneInput = $(`[name=${formipay.buyer_phone_field}]`);
|
||||
const $countrySelect = formipay.buyer_country_field !== "" ? $(`[name=${formipay.buyer_country_field}]`) : '';
|
||||
|
||||
let countryCode = formipay.buyer_phone_country_code || '';
|
||||
|
||||
// Function: Get all available phone codes from select options
|
||||
function getAllCountryCodes() {
|
||||
const codes = [];
|
||||
$countrySelect.find('option').each(function () {
|
||||
const code = $(this).data('phone-code');
|
||||
if (code) codes.push(code.toString());
|
||||
});
|
||||
return codes;
|
||||
}
|
||||
|
||||
// Function: Convert number to WhatsApp-compatible format
|
||||
function toWhatsAppNumber(phoneNumber, newCountryCode = '62') {
|
||||
if (!phoneNumber) return '';
|
||||
|
||||
let cleaned = phoneNumber.replace(/\D/g, '');
|
||||
|
||||
// Step 1: Remove any existing known country code
|
||||
const knownCountryCodes = getAllCountryCodes();
|
||||
|
||||
knownCountryCodes.forEach(code => {
|
||||
if (cleaned.startsWith(code)) {
|
||||
cleaned = cleaned.substring(code.length);
|
||||
}
|
||||
});
|
||||
|
||||
// Step 2: Remove leading zero after removing old country code
|
||||
if (cleaned.startsWith('0')) {
|
||||
cleaned = cleaned.substring(1);
|
||||
}
|
||||
|
||||
// Step 3: Add new country code
|
||||
return newCountryCode + cleaned;
|
||||
}
|
||||
|
||||
// Get current country code dynamically
|
||||
function getCurrentCountryCode() {
|
||||
return $countrySelect.length > 0
|
||||
? ($countrySelect.find(':selected').data('phone-code') || '')
|
||||
: (formipay.buyer_phone_country_code || '');
|
||||
}
|
||||
|
||||
// On country change: Update country code and re-format phone number
|
||||
if ($countrySelect.length > 0) {
|
||||
$countrySelect.on('change', function () {
|
||||
const oldCountryCode = countryCode;
|
||||
countryCode = $countrySelect.find(':selected').data('phone-code') || '';
|
||||
|
||||
if (!countryCode) return;
|
||||
|
||||
const currentValue = $phoneInput.val().trim();
|
||||
|
||||
// If there's a current phone number and country changed
|
||||
if (currentValue && currentValue !== oldCountryCode) {
|
||||
const converted = toWhatsAppNumber(currentValue, countryCode);
|
||||
$phoneInput.val(converted);
|
||||
} else {
|
||||
// Set placeholder if empty
|
||||
$phoneInput.val(countryCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// On focus: insert country code as placeholder
|
||||
$phoneInput.on('focus', function () {
|
||||
const $this = $(this);
|
||||
const currentValue = $this.val().trim();
|
||||
const currentCode = getCurrentCountryCode();
|
||||
|
||||
if (!currentCode) return;
|
||||
|
||||
// Save original value before modifying
|
||||
$this.data('original-value', currentValue);
|
||||
|
||||
if (currentValue === '' || currentValue === currentCode) {
|
||||
$this.val(currentCode);
|
||||
}
|
||||
});
|
||||
|
||||
// On blur: clean up or convert to WhatsApp number
|
||||
$phoneInput.on('blur', function () {
|
||||
const $this = $(this);
|
||||
const originalValue = $this.data('original-value') || '';
|
||||
const currentValue = $this.val().trim();
|
||||
const currentCode = getCurrentCountryCode();
|
||||
|
||||
if (!currentCode) return;
|
||||
|
||||
// Case: user left field empty or only had country code
|
||||
if (currentValue === '' || currentValue === currentCode || currentValue.length <= 4) {
|
||||
$this.val(''); // Clear it for placeholder behavior
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip conversion if already formatted
|
||||
const isAlreadyFormatted = getAllCountryCodes().some(code =>
|
||||
currentValue.startsWith(code)
|
||||
);
|
||||
|
||||
if (!isAlreadyFormatted || originalValue !== currentValue) {
|
||||
const waNumber = toWhatsAppNumber(currentValue, currentCode);
|
||||
$this.val(waNumber);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
75
public/assets/js/payment-confirm.js
Normal file
75
public/assets/js/payment-confirm.js
Normal file
@@ -0,0 +1,75 @@
|
||||
jQuery(document).ready(function($) {
|
||||
const button = $('#confirm-cod-order');
|
||||
const checkbox = $('#cod_agreement');
|
||||
|
||||
// Enable the button when the checkbox is checked
|
||||
checkbox.on('change', function() {
|
||||
button.prop('disabled', !this.checked);
|
||||
});
|
||||
|
||||
button.on('click', function() {
|
||||
|
||||
const formData = {
|
||||
action: 'formipay_cod_confirmation',
|
||||
form_id: $('#form_id').val(),
|
||||
order_id: $('#order_id').val(),
|
||||
formipay_nonce: $('#formipay_nonce').val(),
|
||||
};
|
||||
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
text: "Are you sure to confirm the COD package is arrived and you have paid the bill to courier?",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Yes!",
|
||||
cancelButtonText: `No, I haven't paid the bill yet`,
|
||||
reverseButtons: true,
|
||||
customClass: {
|
||||
confirmButton: 'formipay-submit-button'
|
||||
}
|
||||
}).then((result) => {
|
||||
/* Read more about isConfirmed, isDenied below */
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: formipay_thankyou.ajax_url,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
// Handle success
|
||||
let timerInterval;
|
||||
Swal.fire({
|
||||
html: response.data.message,
|
||||
icon: response.data.icon,
|
||||
timer: 2500,
|
||||
timerProgressBar: true,
|
||||
didOpen: () => {
|
||||
Swal.showLoading();
|
||||
const timer = Swal.getPopup().querySelector("b");
|
||||
timerInterval = setInterval(() => {
|
||||
timer.textContent = `${Swal.getTimerLeft()}`;
|
||||
}, 100);
|
||||
},
|
||||
willClose: () => {
|
||||
clearInterval(timerInterval);
|
||||
},
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showCloseButton: false,
|
||||
}).then((result) => {
|
||||
if (result.dismiss === Swal.DismissReason.timer) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
15
public/assets/js/popup-action.js
Normal file
15
public/assets/js/popup-action.js
Normal file
@@ -0,0 +1,15 @@
|
||||
jQuery(function($){
|
||||
|
||||
let formipay_form_id = $('[data-form-id]').attr('data-form-id');
|
||||
let formipay = formipay_form.forms[formipay_form_id];
|
||||
|
||||
$(document).on('click', formipay.trigger_selector, function() {
|
||||
$(formipay.modal_selector).modal({
|
||||
fadeDuration: 500,
|
||||
escapeClose: false,
|
||||
clickClose: false
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
})
|
||||
464
public/assets/js/public.js
Normal file
464
public/assets/js/public.js
Normal file
@@ -0,0 +1,464 @@
|
||||
jQuery(function($){
|
||||
|
||||
function validateForm(input_class) {
|
||||
var valid = true;
|
||||
input_class.each(function () {
|
||||
if ($(this).val() === '') {
|
||||
valid = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return valid;
|
||||
}
|
||||
|
||||
function price_format(nStr) {
|
||||
nStr = parseFloat(nStr).toFixed(formipay.decimal_digits) + '';
|
||||
var x = nStr.split('.');
|
||||
var x1 = x[0];
|
||||
var x2 = x.length > 1 ? formipay.decimal_symbol + x[1] : '';
|
||||
var rgx = /(\d+)(\d{3})/;
|
||||
while (rgx.test(x1)) {
|
||||
x1 = x1.replace(rgx, '$1' + formipay.thousand_separator + '$2');
|
||||
}
|
||||
return formipay.currency + ' ' + x1 + x2;
|
||||
}
|
||||
|
||||
$('.product-price-row').find('td').html(price_format($('#product_price').val()));
|
||||
$('.formipay-payment-option-group:first-child').find('input').trigger('click');
|
||||
|
||||
function calculate_fields() {
|
||||
|
||||
var calc_field = $('.formipay-input-calculable');
|
||||
var button_text = $('.formipay-submit-button').data('button-text');
|
||||
|
||||
$('table#formipay-review-order tr:not(.formipay-product-row)').remove();
|
||||
|
||||
var price = parseInt($('#product_price').val());
|
||||
|
||||
var total = price;
|
||||
var qty = parseInt($('.formipay-qty-input').val());
|
||||
var total = price * qty;
|
||||
|
||||
$('tr.formipay-product-row').find('td').html(price_format(total));
|
||||
|
||||
if(calc_field.length > 0){
|
||||
$.each(calc_field, function(o, p){
|
||||
var field_amount = 0;
|
||||
var value_badge = false;
|
||||
var badge_label = '';
|
||||
var qty_label = '';
|
||||
if($(p).hasClass('formipay-select')){
|
||||
value_badge = true;
|
||||
badge_label = $(p).find('option:selected').text();
|
||||
field_amount = $(p).find('option:selected').attr('data-calc-value');
|
||||
}else if($(p).attr('type') == 'hidden'){
|
||||
field_amount = $(p).attr('data-calc-value');
|
||||
}else{
|
||||
if($(p).is(':checked')){
|
||||
value_badge = true;
|
||||
badge_label = $(p).siblings('span').text();
|
||||
field_amount = $(p).attr('data-calc-value');
|
||||
}
|
||||
}
|
||||
if(!field_amount){
|
||||
field_amount = 0;
|
||||
}
|
||||
if($(p).hasClass('formipay-select')){
|
||||
if(formipay.quantity_toggle == 'on' && $(p).find('option:selected').attr('data-qty-multiply') == 'yes'){
|
||||
field_amount = parseFloat(field_amount) * parseInt(qty);
|
||||
if(qty > 1){
|
||||
qty_label = ' ✕ '+qty;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(formipay.quantity_toggle == 'on' && $(p).attr('data-qty-multiply') == 'yes'){
|
||||
field_amount = parseFloat(field_amount) * parseInt(qty);
|
||||
if(qty > 1){
|
||||
qty_label = ' ✕ '+qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var label = '<span class="order-item">'+$(p).attr('data-label')+qty_label+'</span>';
|
||||
if(value_badge){
|
||||
label += '<span class="formipay-value-badge">'+badge_label+'</span>';
|
||||
}
|
||||
|
||||
if(field_amount > 0){
|
||||
$('table#formipay-review-order').find('tbody').append(`
|
||||
<tr class="formipay-item-row">
|
||||
<th>`+label+`</th>
|
||||
<td>`+price_format(field_amount)+`</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
total = parseFloat(total) + parseFloat(field_amount);
|
||||
});
|
||||
|
||||
$('table#formipay-review-order').find('tbody').append(`
|
||||
<tr class="formipay-total-row">
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
`);
|
||||
|
||||
if($('#formipay-shipping-cost').val() > 0){
|
||||
total = total + parseInt($('#formipay-shipping-cost').val());
|
||||
$('table#formipay-review-order').find('tbody').append(`
|
||||
<tr class="formipay-shipping-row">
|
||||
<th>Shipping</th>
|
||||
<td>`+price_format($('#formipay-shipping-cost').val())+`</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
$('table#formipay-review-order').find('tbody').append(`
|
||||
<tr class="formipay-grand-total-row">
|
||||
<th>Total</th>
|
||||
<td>`+price_format(total)+`</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
$('.formipay-submit-button').text(button_text+' - '+price_format(total));
|
||||
|
||||
}
|
||||
|
||||
calculate_fields();
|
||||
|
||||
// PAGE BREAK
|
||||
var page_break = $('.formipay-page-break');
|
||||
if(page_break.length > 0){
|
||||
$.each( $('.formipay-field-group:not(.formipay-page-break)'), function(){
|
||||
var prev_page_break = $(this).prev('.formipay-page-break');
|
||||
$(this).appendTo(prev_page_break);
|
||||
} );
|
||||
var payment_page_break = $('.formipay-page-break.formipay-page-break-payment');
|
||||
$('.result-wrapper').appendTo(payment_page_break);
|
||||
$.each( page_break, function(index, page){
|
||||
if(index > 0){
|
||||
$(page).hide();
|
||||
}
|
||||
index = index + 1;
|
||||
$(page).addClass('formipay-page-'+index);
|
||||
});
|
||||
$('.formipay-page-break-payment .formipay-submit-button').appendTo('.formipay-bottom-pagination').css({
|
||||
'margin-left': 'unset',
|
||||
'margin-right': 'unset'
|
||||
}).hide();
|
||||
}
|
||||
var page_break_progress = $('.formipay-progress');
|
||||
if(page_break_progress.length > 0){
|
||||
// $(page_break_progress[0]).addClass('active');
|
||||
$.each(page_break_progress, function(index, page){
|
||||
if(index == 0){
|
||||
$(page).addClass('active');
|
||||
}
|
||||
index = index + 1;
|
||||
$(page).attr('data-page-number', index);
|
||||
});
|
||||
}
|
||||
|
||||
$('.formipay-progress').on('click', function(){
|
||||
var page_number = $(this).attr('data-page-number');
|
||||
var inputs_in_page = $('.formipay-page-break:visible').find('.formipay-input');
|
||||
var valid_to_continue = check_page_input_invalid(inputs_in_page);
|
||||
|
||||
if(valid_to_continue === false){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($('.formipay-page-'+page_number).hasClass('formipay-page-break-payment')){
|
||||
$('.formipay-page-break-next-button').hide();
|
||||
$('.formipay-page-break-next-button').siblings('.formipay-submit-button').show();
|
||||
}else{
|
||||
$('.formipay-page-break-next-button').show();
|
||||
$('.formipay-page-break-next-button').siblings('.formipay-submit-button').hide();
|
||||
}
|
||||
|
||||
$('.formipay-progress').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.formipay-page-break').hide();
|
||||
$('.formipay-page-'+page_number).show();
|
||||
});
|
||||
|
||||
function check_page_input_invalid(inputs){
|
||||
var invalid_input = 0;
|
||||
inputs.each(function(index, field) {
|
||||
var the_label = $(field).data('label');
|
||||
// $(field).removeAttr('style');
|
||||
$(field).removeClass('formipay-input-invalid')
|
||||
if (!$(field).is(':valid')) {
|
||||
// $(field).attr('style', 'border-color: #d93258!important;');
|
||||
$(field).addClass('formipay-input-invalid');
|
||||
$(field).siblings('.formipay-validate-field').remove();
|
||||
if ($(field).attr('type') == 'select' || $(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if ($(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if ($('[name="' + $(field).attr('name') + '"]:checked').length == 0) {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
}
|
||||
} else if ($(field).attr('name').search('agreement') != -1) {
|
||||
var notice_message = formipay.notice_empty_agreement_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
}
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_text_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
invalid_input ++;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(invalid_input > 0){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$('.formipay-page-break-next-button').on('click', function(e){
|
||||
var next_page = $('.formipay-page-break:visible').next('.formipay-page-break');
|
||||
var inputs_in_page = $('.formipay-page-break:visible').find('.formipay-input');
|
||||
|
||||
var valid_to_continue = check_page_input_invalid(inputs_in_page);
|
||||
|
||||
if(valid_to_continue === false){
|
||||
return false;
|
||||
}
|
||||
|
||||
var active_progress = $('.formipay-progress.active');
|
||||
if(next_page.length > 0){
|
||||
active_progress.next('.formipay-progress').addClass('active');
|
||||
active_progress.removeClass('active');
|
||||
if(next_page.hasClass('formipay-page-break-payment')){
|
||||
// $(this).prop('disabled', true);
|
||||
$(this).hide();
|
||||
$(this).siblings('.formipay-submit-button').show();
|
||||
}
|
||||
$('.formipay-page-break:visible').hide();
|
||||
next_page.show();
|
||||
e.target.blur()
|
||||
}
|
||||
$('.formipay-page-break-prev-button').prop('disabled', false);
|
||||
});
|
||||
|
||||
$('.formipay-page-break-prev-button').on('click', function(e){
|
||||
var prev_page = $('.formipay-page-break:visible').prev('.formipay-page-break');
|
||||
var active_progress = $('.formipay-progress.active');
|
||||
if(prev_page.length > 0){
|
||||
active_progress.prev('.formipay-progress').addClass('active');
|
||||
active_progress.removeClass('active');
|
||||
if(prev_page.is('.formipay-page-break:nth-child(2)')){
|
||||
$(this).prop('disabled', true);
|
||||
}
|
||||
$('.formipay-page-break-next-button').show();
|
||||
$('.formipay-page-break-next-button').siblings('.formipay-submit-button').hide();
|
||||
$('.formipay-page-break:visible').hide();
|
||||
prev_page.show();
|
||||
e.target.blur()
|
||||
}
|
||||
$('.formipay-page-break-next-button').prop('disabled', false);
|
||||
});
|
||||
|
||||
$('.formipay-input, .formipay-qty-input').on('change', function(){
|
||||
calculate_fields();
|
||||
});
|
||||
|
||||
$(document).on('click', '.formipay-copy-button', function() {
|
||||
var $this = $(this);
|
||||
var copiedtext = $(this).prev("p").attr("data-copy-value");
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(copiedtext)
|
||||
.then(() => {
|
||||
$this.html('<i class="bi bi-check-circle-fill"></i> '+$this.attr('data-copied-text'));
|
||||
setTimeout(() => {
|
||||
$this.html('<i class="bi bi-copy"></i> '+$this.attr('data-copy-text'));
|
||||
}, 1200);
|
||||
})
|
||||
.catch((error) => {
|
||||
$this.html('<i class="bi bi-check-circle-fill"></i> '+$this.attr('data-not-copied-text'));
|
||||
setTimeout(() => {
|
||||
$this.html('<i class="bi bi-copy"></i> '+$this.attr('data-copy-text'));
|
||||
}, 1200);
|
||||
});
|
||||
} else {
|
||||
$this.html('<i class="bi bi-check-circle-fill"></i> '+$this.attr('data-not-copied-text'));
|
||||
setTimeout(() => {
|
||||
$this.html('<i class="bi bi-copy"></i> '+$this.attr('data-copy-text'));
|
||||
}, 1200);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('.formipay-submit-button').on('submit click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$(this).text(formipay.button_processing_text).prop('disabled', true);
|
||||
|
||||
var form = $(this).parents('form');
|
||||
var form_id = form.data('form-id');
|
||||
var inputs = form.find('.formipay-input');
|
||||
|
||||
var form_inputs = new FormData();
|
||||
|
||||
form_inputs.append('action', 'formipay_submission');
|
||||
form_inputs.append('data[qty]', $('.formipay-qty-input').val());
|
||||
form_inputs.append('form_id', form_id);
|
||||
|
||||
var $valid = true; // Initialize as true
|
||||
|
||||
inputs.each(function(index, field) {
|
||||
var the_key = $(field).attr('name');
|
||||
var the_label = $(field).data('label');
|
||||
|
||||
// $(field).removeAttr('style');
|
||||
$(field).removeClass('formipay-input-invalid');
|
||||
|
||||
if (!$(field).is(':valid')) {
|
||||
// $(field).attr('style', 'border-color: #d93258!important;');
|
||||
$(field).addClass('formipay-input-invalid');
|
||||
$(field).siblings('.formipay-validate-field').remove();
|
||||
|
||||
if ($(field).attr('type') == 'select' || $(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if ($(field).attr('type') == 'radio' || $(field).attr('type') == 'checkbox') {
|
||||
if (!$('[name="' + $(field).attr('name') + '"]:checked').length) {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
$valid = false; // Set valid to false
|
||||
}
|
||||
} else if ($(field).attr('name').search('agreement') != -1) {
|
||||
var notice_message = formipay.notice_empty_agreement_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
$valid = false; // Set valid to false
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_select_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
$valid = false; // Set valid to false
|
||||
}
|
||||
} else {
|
||||
var notice_message = formipay.notice_empty_text_message;
|
||||
$(field).parent().append('<p class="formipay-validate-field"><i class="bi bi-exclamation-circle"></i> '+notice_message.replace('{{field}}', the_label)+'</p>');
|
||||
$valid = false; // Set valid to false
|
||||
}
|
||||
} else {
|
||||
var the_value;
|
||||
if ($(field).attr('type') == 'checkbox') {
|
||||
var val = [];
|
||||
form.find('[name=' + the_key + ']:checked').each(function(i, check) {
|
||||
val[i] = $(check).val();
|
||||
});
|
||||
the_value = val;
|
||||
} else if ($(field).attr('type') == 'radio') {
|
||||
the_value = $('[name=' + the_key + ']:checked').val();
|
||||
} else {
|
||||
the_value = $(field).val();
|
||||
}
|
||||
|
||||
if ($(field).attr('type') == 'hidden' || $(field).parent().is(':hidden')) {
|
||||
if ($(field).hasClass('formipay-select')) {
|
||||
form_inputs.append('data[' + the_key + '][value]', the_value);
|
||||
form_inputs.append('data[' + the_key + '][label]', $(field).find('option:selected').attr('data-label'));
|
||||
} else {
|
||||
form_inputs.append('data[' + the_key + ']', the_value);
|
||||
}
|
||||
} else {
|
||||
$(field).siblings('.formipay-validate-field').remove();
|
||||
|
||||
if ($(field).hasClass('formipay-select')) {
|
||||
form_inputs.append('data[' + the_key + '][value]', the_value);
|
||||
form_inputs.append('data[' + the_key + '][label]', $(field).find('option:selected').attr('data-label'));
|
||||
} else {
|
||||
form_inputs.append('data[' + the_key + ']', the_value);
|
||||
}
|
||||
|
||||
if(
|
||||
the_key == 'payment' &&
|
||||
typeof trx_fee !== typeof undefined && trx_fee !== false &&
|
||||
trx_fee > 0
|
||||
) {
|
||||
form_inputs.append('data[trx_fee]', $('[name=' + the_key + ']:checked').attr('data-calc-value'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if($valid) {
|
||||
$.ajax({
|
||||
url: formipay.ajax_url,
|
||||
data: form_inputs,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
beforeSend: function() {
|
||||
form.find('.formipay-validate-field').remove();
|
||||
$('.formipay-input').removeAttr('style');
|
||||
$('[data-form-id=' + form_id + ']').siblings('.submit-response').html('');
|
||||
$('[data-form-id=' + form_id + ']').siblings('.submit-response').hide();
|
||||
$('[data-form-id=' + form_id + ']').siblings('.submit-response').removeClass('formipay-message-success formipay-message-failed');
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
if(res.success) {
|
||||
if(res.data.response_type == 'notice') {
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').html('Success! ' + res.data.message);
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').addClass('formipay-message-success');
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').show();
|
||||
if(res.data.action_type == 'thankyou'){
|
||||
$('[data-form-id=' + form_id + ']').siblings('.formipay-thankyou').html(res.data.thankyou);
|
||||
setTimeout(() => {
|
||||
$('[data-form-id=' + form_id + ']').find('.formipay-thankyou').show();
|
||||
$('[data-form-id=' + form_id + ']').remove();
|
||||
window.location.href = res.data.url;
|
||||
}, 2500);
|
||||
}else{
|
||||
window.location.href = res.data.url;
|
||||
}
|
||||
} else if(res.data.response_type == 'popup') {
|
||||
$('[data-form-id=' + form_id + ']').find('.formipay-thankyou').html(res.data.thankyou);
|
||||
Swal.fire({
|
||||
title: 'Success!',
|
||||
html: res.data.message,
|
||||
icon: 'success'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
if(res.data.action_type == 'thankyou'){
|
||||
$('[data-form-id=' + form_id + ']').find('.formipay-thankyou').show();
|
||||
$('[data-form-id=' + form_id + ']').remove();
|
||||
}else{
|
||||
window.location.href = res.data.url;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if(res.data.response_type == 'notice') {
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').html('Failed! ' + res.data.message);
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').addClass('formipay-message-failed');
|
||||
$('[data-form-id=' + form_id + ']').find('.submit-response').show();
|
||||
} else if(res.data.response_type == 'popup') {
|
||||
Swal.fire({
|
||||
title: 'Failed!',
|
||||
html: res.data.message,
|
||||
icon: 'error'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
feather.replace();
|
||||
|
||||
});
|
||||
171
public/assets/js/thankyou.js
Normal file
171
public/assets/js/thankyou.js
Normal file
@@ -0,0 +1,171 @@
|
||||
jQuery(function($){
|
||||
|
||||
$(document).on('click', '.formipay-copy-button', function() {
|
||||
var $this = $(this);
|
||||
var copiedtext = $(this).prev('p').attr("data-copy-value");
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(copiedtext)
|
||||
.then(() => {
|
||||
$this.html('<i class="bi bi-check-circle-fill"></i> '+$this.attr('data-copied-text'));
|
||||
setTimeout(() => {
|
||||
$this.html('<i class="bi bi-copy"></i> '+$this.attr('data-copy-text'));
|
||||
}, 1200);
|
||||
})
|
||||
.catch((error) => {
|
||||
$this.html('<i class="bi bi-exclamation-circle-fill"></i> '+$this.attr('data-not-copied-text'));
|
||||
setTimeout(() => {
|
||||
$this.html('<i class="bi bi-copy"></i> '+$this.attr('data-copy-text'));
|
||||
}, 1200);
|
||||
});
|
||||
} else {
|
||||
$this.html('<i class="bi bi-check-circle-fill"></i> '+$this.attr('data-not-copied-text'));
|
||||
setTimeout(() => {
|
||||
$this.html('<i class="bi bi-copy"></i> '+$this.attr('data-copy-text'));
|
||||
}, 1200);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Store a reference to the file input element
|
||||
let fileInput;
|
||||
let thumbnailPreview;
|
||||
let previewImage;
|
||||
|
||||
function initializeUploadFunctionality() {
|
||||
const dropzoneArea = $('#dropzoneArea');
|
||||
fileInput = $('#fileInput');
|
||||
thumbnailPreview = $('#thumbnailPreview');
|
||||
previewImage = $('#previewImage');
|
||||
|
||||
fileInput.hide();
|
||||
thumbnailPreview.hide();
|
||||
|
||||
// Click event to open file selector
|
||||
dropzoneArea.on('click', function(event) {
|
||||
if (!$(event.target).is(fileInput)) {
|
||||
fileInput.trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
// Change event for file input
|
||||
fileInput.on('change', handleFileSelect);
|
||||
|
||||
// Drag and drop events
|
||||
dropzoneArea.on('dragover', function(e) {
|
||||
e.preventDefault(); // Prevent default behavior
|
||||
e.stopPropagation();
|
||||
dropzoneArea.addClass('dragging'); // Add class to change style on drag
|
||||
});
|
||||
|
||||
dropzoneArea.on('dragleave', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dropzoneArea.removeClass('dragging'); // Remove class on drag leave
|
||||
});
|
||||
|
||||
dropzoneArea.on('drop', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dropzoneArea.removeClass('dragging'); // Remove class on drop
|
||||
const files = e.originalEvent.dataTransfer.files; // Get dropped files
|
||||
if (files.length > 0) {
|
||||
fileInput[0].files = files; // Assign files to input
|
||||
handleFileSelect(); // Trigger file selection handling
|
||||
}
|
||||
});
|
||||
|
||||
// Submit event for the form
|
||||
$('#uploadForm').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(this);
|
||||
|
||||
$.ajax({
|
||||
url: formipay_thankyou.ajax_url, // Adjust if necessary
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
beforeSend: function() {
|
||||
$('#uploadForm').block({ message: 'Uploading order receipt...' });
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle success
|
||||
let timerInterval;
|
||||
Swal.fire({
|
||||
html: response.data.message,
|
||||
icon: response.data.icon,
|
||||
timer: 2500,
|
||||
timerProgressBar: true,
|
||||
didOpen: () => {
|
||||
Swal.showLoading();
|
||||
const timer = Swal.getPopup().querySelector("b");
|
||||
timerInterval = setInterval(() => {
|
||||
timer.textContent = `${Swal.getTimerLeft()}`;
|
||||
}, 100);
|
||||
},
|
||||
willClose: () => {
|
||||
clearInterval(timerInterval);
|
||||
},
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
showCloseButton: false,
|
||||
}).then((result) => {
|
||||
if (result.dismiss === Swal.DismissReason.timer) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Function to handle file selection and preview
|
||||
function handleFileSelect() {
|
||||
const file = fileInput[0].files[0];
|
||||
|
||||
if (file) {
|
||||
const validTypes = ['image/jpeg', 'image/png'];
|
||||
const maxFileSize = 1 * 1024 * 1024; // 1 MB in bytes
|
||||
|
||||
// Check file type and size
|
||||
if (validTypes.indexOf(file.type) === -1) {
|
||||
// alert('Please upload a JPG or PNG file.');
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
html: 'Please upload a JPG or PNG file.'
|
||||
});
|
||||
fileInput.val(''); // Clear the input
|
||||
thumbnailPreview.hide();
|
||||
thumbnailPreview.siblings('.bi').show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.size > maxFileSize) {
|
||||
// alert('File size must be less than 1 MB.');
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
html: 'File size must be less than 1 MB.'
|
||||
});
|
||||
fileInput.val(''); // Clear the input
|
||||
thumbnailPreview.hide();
|
||||
thumbnailPreview.siblings('.bi').show();
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
previewImage.attr('src', e.target.result);
|
||||
thumbnailPreview.show();
|
||||
thumbnailPreview.siblings('.bi').hide();
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
|
||||
initializeUploadFunctionality();
|
||||
|
||||
});
|
||||
60
public/templates/privacy-policy.html
Normal file
60
public/templates/privacy-policy.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!-- wp:paragraph -->
|
||||
<h2>Privacy Policy for {$site_name}</h2>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p><strong>Effective Date:</strong> [current-date]</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<h3>1. Data Collection</h3>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul>
|
||||
<li><strong>Order Information:</strong> We collect order details including items purchased, total amount, and payment method</li>
|
||||
<li><strong>Technical Data:</strong> Automatically collected information includes IP address, browser type, device information, and referring URLs</li>
|
||||
<li><strong>User Data:</strong> For logged-in users, we store WordPress user ID associated with transactions</li>
|
||||
</ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<h3>2. Data Usage</h3>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul>
|
||||
<li>Process and fulfill orders</li>
|
||||
<li>Prevent fraud and ensure transaction security</li>
|
||||
<li>Improve our services through analytics</li>
|
||||
<li>Comply with legal obligations</li>
|
||||
</ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<h3>3. Data Sharing</h3>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul>
|
||||
<li>Payment processors (Stripe/PayPal) for transaction processing</li>
|
||||
<li>Shipping providers for order fulfillment</li>
|
||||
<li>Legal authorities when required by law</li>
|
||||
</ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<h3>4. Your Rights</h3>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul>
|
||||
<li>Request access to your personal data</li>
|
||||
<li>Request correction of inaccurate data</li>
|
||||
<li>Request deletion of your data (subject to legal requirements)</li>
|
||||
</ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>For data requests, contact us at: <a href="mailto:{$admin_email}">{$admin_email}</a></p>
|
||||
<!-- /wp:paragraph -->
|
||||
238
public/templates/single-formipay.php
Normal file
238
public/templates/single-formipay.php
Normal file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
get_header(); // Add your header template if needed
|
||||
$form_settings = get_post_meta(get_the_ID(), 'formipay_settings', true);
|
||||
$post_id = get_the_ID();
|
||||
?>
|
||||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main">
|
||||
<?php
|
||||
while (have_posts()) :
|
||||
the_post();
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<div class="entry-content">
|
||||
<div class="formipay-form-wrapper">
|
||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
<form class="formipay-form" data-form-id="<?php echo intval($post_id) ?>">
|
||||
<input type="hidden" id="product_name" value="<?php echo esc_attr(formipay_get_post_meta($post_id, 'product_title')); ?>">
|
||||
<input type="hidden" id="product_price" value="<?php echo esc_attr(formipay_get_post_meta($post_id, 'product_price')); ?>">
|
||||
<?php
|
||||
|
||||
$timezone = new DateTimeZone( wp_timezone_string() );
|
||||
|
||||
$require_login = false;
|
||||
if(formipay_get_post_meta($post_id, 'require_login') == 'on'){
|
||||
$require_login = true;
|
||||
}
|
||||
|
||||
$scheduled = false;
|
||||
$date_range = '';
|
||||
$date_from = '';
|
||||
$date_to = '';
|
||||
if(formipay_get_post_meta($post_id, 'schedule_toggle') == 'on'){
|
||||
$scheduled = true;
|
||||
if(false !== formipay_get_post_meta($post_id, 'daterange')){
|
||||
$date_range = explode(' - ', formipay_get_post_meta($post_id, 'daterange') );
|
||||
$date_from = DateTime::createFromFormat('m/d/Y', $date_range[0], $timezone);
|
||||
$date_to = DateTime::createFromFormat('m/d/Y', $date_range[1], $timezone);
|
||||
|
||||
$timestamp_from = $date_from ? $date_from->getTimestamp() : false;
|
||||
$timestamp_to = $date_to ? $date_to->getTimestamp() : false;
|
||||
}
|
||||
}
|
||||
|
||||
$render = true;
|
||||
|
||||
if($require_login && !is_user_logged_in()){
|
||||
$render = false;
|
||||
?>
|
||||
<div class="formipay-message">
|
||||
<?php echo wp_kses_post( formipay_get_post_meta($post_id, 'require_login_message')); ?>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($scheduled) {
|
||||
if($timestamp_from > time()) {
|
||||
$render = false;
|
||||
?>
|
||||
<div class="formipay-message">
|
||||
<?php echo wp_kses_post(formipay_get_post_meta($post_id, 'waiting_message')); ?>
|
||||
</div>
|
||||
<?php
|
||||
}elseif(time() > $timestamp_to){
|
||||
$render = false;
|
||||
?>
|
||||
<div class="formipay-message">
|
||||
<?php echo wp_kses_post(formipay_get_post_meta($post_id, 'expired_message')); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if($render) {
|
||||
if(false !== $form_settings && is_array($form_settings['fields']) && count($form_settings['fields']) > 0){
|
||||
foreach($form_settings['fields'] as $field_id => $field){
|
||||
$field_id = str_replace('_config', '', $field_id);
|
||||
$not_input = ['select', 'checkbox', 'radio', 'textarea'];
|
||||
$required = '';
|
||||
if($field['is_required'] == 'yes'){
|
||||
$required = ' required';
|
||||
}
|
||||
$asterisk = '(*)';
|
||||
if(formipay_get_post_meta($post_id, 'required_field_sign') == 'text'){
|
||||
$asterisk = formipay_get_post_meta($post_id, 'required_text');
|
||||
}
|
||||
$placeholder = $field['placeholder'];
|
||||
if(formipay_get_post_meta($post_id, 'field_placeholder') == 'label'){
|
||||
$placeholder = $field['label'].' '.$asterisk;
|
||||
}
|
||||
$label_show = true;
|
||||
if(formipay_get_post_meta($post_id, 'label_visibility') == 'hide'){
|
||||
$label_show = false;
|
||||
}
|
||||
$display_label = '';
|
||||
if($label_show) {
|
||||
$display_label = 'd-none';
|
||||
}
|
||||
$calculable = '';
|
||||
if(in_array($field['field_type'], ['number', 'hidden', 'select', 'checkbox', 'radio'])){
|
||||
$calculable = ' formipay-input-calculable';
|
||||
}
|
||||
$calc = '';
|
||||
if(!isset($field['calc_value'])){
|
||||
$field['calc_value'] = 0;
|
||||
}
|
||||
if(in_array($field['field_type'], ['number', 'hidden'])){
|
||||
$calc = 'data-calc-value="'.$field['calc_value'].'"';
|
||||
}
|
||||
if(!in_array($field['field_type'], $not_input)){
|
||||
$show = '';
|
||||
if($field['field_type'] == 'hidden'){
|
||||
$show = ' formipay-hidden-group';
|
||||
}
|
||||
?>
|
||||
<div class="formipay-field-group<?php echo esc_attr($show); ?>">
|
||||
<label for="<?php echo esc_attr($field_id); ?>" class="formipay-label <?php echo esc_attr($display_label); ?>"><?php echo esc_html($field['label']); ?> <?php echo ('' !== $required) ? '<span class="formipay-asterisk">'.esc_html($asterisk).'</span>' : '' ?></label>
|
||||
<input type="<?php echo esc_attr($field['field_type']); ?>" name="<?php echo esc_attr($field_id); ?>" class="formipay-input<?php echo esc_attr($calculable); ?>" value="<?php echo esc_attr($field['default_value']); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" data-label="<?php echo esc_attr($field['label']); ?>"<?php echo esc_attr($calc) . esc_attr($required); ?>>
|
||||
<p class="formipay-input-desc mb-0"><?php echo esc_html($field['description']); ?></p>
|
||||
<p class="formipay-validate-field"></p>
|
||||
</div>
|
||||
<?php
|
||||
}else{
|
||||
if($field['field_type'] == 'textarea'){
|
||||
?>
|
||||
<div class="formipay-field-group">
|
||||
<label for="<?php echo esc_attr($field_id); ?>" class="formipay-label <?php echo esc_attr($display_label); ?>"><?php echo esc_html($field['label']); ?> <?php echo ('' !== $required) ? '<span class="formipay-asterisk">'.esc_html($asterisk).'</span>' : '' ?></label>
|
||||
<textarea class="formipay-input" name="<?php echo esc_attr($field_id) ?>" placeholder="<?php echo esc_attr($placeholder); ?>" data-label="<?php echo esc_attr($field['label']); ?>"<?php echo esc_attr($required); ?> rows="4"><?php echo esc_html($field['default_value']); ?></textarea>
|
||||
<p class="formipay-input-desc mb-0"><?php echo esc_html($field['description']); ?></p>
|
||||
<p class="formipay-validate-field"></p>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($field['field_type'] == 'select'){
|
||||
$options = '';
|
||||
if(!empty($field['field_options'])){
|
||||
$field_options = explode(PHP_EOL, $field['field_options']);
|
||||
foreach($field_options as $option){
|
||||
$explode = explode('|', $option);
|
||||
$label = $explode[0];
|
||||
$value = $label;
|
||||
$calc = 0;
|
||||
if(isset($explode[1])){
|
||||
$value = $explode[1];
|
||||
}
|
||||
if(isset($explode[2])){
|
||||
$calc = $explode[2];
|
||||
}
|
||||
$selected = '';
|
||||
if($field['default_value'] == $value){
|
||||
$selected = ' selected';
|
||||
}
|
||||
$options .= '<option value="'.$value.'" data-label="'.$label.'" data-calc-value="'.$calc.'" '.$selected.'>'.$label.'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="formipay-field-group">
|
||||
<label for="<?php echo esc_attr($field_id); ?>" class="formipay-label <?php echo esc_attr($display_label); ?>"><?php echo esc_html($field['label']); ?> <?php echo ('' !== $required) ? '<span class="formipay-asterisk">'.esc_html($asterisk).'</span>' : '' ?></label>
|
||||
<select id="<?php echo esc_attr($field_id); ?>" name="<?php echo esc_attr($field_id); ?>" class="formipay-input formipay-select<?php echo esc_attr($calculable); ?>" data-label="<?php echo esc_attr($field['label']); ?>"<?php echo esc_attr($required); ?>><?php echo wp_kses_post($options); ?></select>
|
||||
<p class="formipay-input-desc mb-0"><?php echo esc_html($field['description']); ?></p>
|
||||
<p class="formipay-validate-field"></p>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($field['field_type'] == 'radio'){
|
||||
?>
|
||||
<div class="formipay-field-group">
|
||||
<label class="formipay-label <?php echo esc_attr($display_label); ?>">
|
||||
<span class="label-text"><?php echo esc_html($field['label']); ?></span>
|
||||
<?php echo ('' !== $required) ? '<span class="formipay-asterisk">'.esc_html($asterisk).'</span>' : '' ?>
|
||||
</label>
|
||||
<?php
|
||||
$field_options = explode(PHP_EOL, $field['field_options']);
|
||||
foreach($field_options as $index => $option){
|
||||
$explode = explode('|', $option);
|
||||
$label = $explode[0];
|
||||
$value = $label;
|
||||
$calc = 0;
|
||||
if(isset($explode[1])){
|
||||
$value = $explode[1];
|
||||
}
|
||||
if(isset($explode[2])){
|
||||
$calc = 'data-calc-value="'.$explode[2].'"';;
|
||||
}
|
||||
$checked = '';
|
||||
if($field['default_value'] == $value){
|
||||
$checked = ' checked';
|
||||
}
|
||||
?>
|
||||
<div class="formipay-radio-option-group">
|
||||
|
||||
<input type="radio" name="<?php echo esc_attr($field_id); ?>" id="<?php echo esc_attr($field_id).'-'.esc_attr($index); ?>" class="formipay-input<?php echo esc_attr($calculable); ?>" value="<?php echo esc_attr($value); ?>" placeholder="<?php echo esc_attr($placeholder); ?>" data-label="<?php echo esc_attr($label); ?>"<?php echo esc_attr($calc) . esc_attr($required) . esc_attr($checked); ?>>
|
||||
|
||||
<label for="<?php echo esc_attr($field_id).'-'.esc_attr($index); ?>" class="formipay-label <?php echo esc_attr($display_label); ?>"><?php echo esc_html($label); ?></label>
|
||||
|
||||
<p class="formipay-input-desc mb-0"><?php echo esc_html($field['description']); ?></p>
|
||||
<p class="formipay-validate-field"></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="form-calculation form-calculate-<?php echo intval($post_id) ?>">
|
||||
<h4><?php echo esc_html__('Your Order', 'formipay'); ?></h4>
|
||||
<table id="formipay-review-order">
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if(formipay_get_post_meta($post_id, 'product_type') == 'physical') { ?>
|
||||
<input type="hidden" class="form-control" id="formipay-shipping-cost" value="0">
|
||||
<?php } ?>
|
||||
|
||||
<input type="hidden" class="form-control" id="formipay-total">
|
||||
<button
|
||||
data-button-text="<?php echo esc_attr(formipay_get_post_meta($post_id, 'button_text')); ?>"
|
||||
type="submit"
|
||||
class="formipay-submit-button"
|
||||
style="background-color: <?php echo esc_attr(formipay_get_post_meta($post_id, 'button_bg_color')); ?>; color: <?php echo esc_attr(formipay_get_post_meta($post_id, 'button_text_color')); ?>; width: <?php echo (formipay_get_post_meta($post_id, 'button_width') == 'fit-content') ? 'fit-content' : '100%'; ?>; margin-left: <?php echo (formipay_get_post_meta($post_id, 'button_position') !== 'left') ? 'auto' : 'unset'; ?>; margin-right: <?php echo (formipay_get_post_meta($post_id, 'button_position') !== 'right') ? 'auto' : 'unset'; ?>;"
|
||||
>
|
||||
<?php echo esc_html(formipay_get_post_meta($post_id, 'button_text')); ?>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<div class="submit-response formipay-message" style="display: none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
get_footer(); // Add your footer template if needed
|
||||
?>
|
||||
59
public/templates/thank-you.php
Normal file
59
public/templates/thank-you.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Thankyou for your order #<?php echo intval($order_id); ?></title>
|
||||
<?php wp_head(); ?>
|
||||
<style>
|
||||
body {
|
||||
--formipay-button-submit-bg-color: <?php echo esc_html($button_background_color['regular']) ?? '#000000'; ?>;
|
||||
--formipay-button-submit-bg-color-hover: <?php echo esc_html($button_background_color['hover']) ?? '#ffffff'; ?>;
|
||||
--formipay-button-submit-bg-color-active: <?php echo esc_html($button_background_color['active']) ?? '#ffffff'; ?>;
|
||||
--formipay-button-submit-text-color: <?php echo esc_html($button_text_color['regular']) ?? '#ffffff'; ?>;
|
||||
--formipay-button-submit-text-color-hover: <?php echo esc_html($button_text_color['hover']) ?? '#000000'; ?>;
|
||||
--formipay-button-submit-text-color-active: <?php echo esc_html($button_text_color['active']) ?? '#000000'; ?>;
|
||||
--formipay-button-submit-border-color: <?php echo esc_html($button_border_color['regular']) ?? '#000000'; ?>;
|
||||
--formipay-button-submit-border-color-hover: <?php echo esc_html($button_border_color['hover']) ?? '#ffffff'; ?>;
|
||||
--formipay-button-submit-border-color-hover: <?php echo esc_html($button_border_color['hover']) ?? '#ffffff'; ?>;
|
||||
--formipay-button-submit-border-color-active: <?php echo esc_html($button_border_color['active']) ?? '#ffffff'; ?>;
|
||||
--formipay-thankyou-screen-width: <?php echo intval($formipay_settings['thankyou_page_wrapper_max_width']) ?? 600 ?>px;
|
||||
--formipay-thankyou-container-bg-color: <?php echo esc_html($formipay_settings['thankyou_page_container_bg_color']) ?? '#808080'; ?>;
|
||||
--formipay-thankyou-wrapper-bg-color: <?php echo esc_html($formipay_settings['thankyou_page_wrapper_bg_color']) ?? '#ffffff'; ?>;
|
||||
--formipay-thankyou-table-alignment: <?php echo esc_html(formipay_get_post_meta($form_id, 'thankyou_screen_table_alignment')) ?? 'center'; ?>;
|
||||
--formipay-confirm-dropzone-bg-color: <?php echo esc_html($formipay_settings['bank_transfer_confirmation_dropzone_color']) ?? '#cccccc'; ?>;
|
||||
--formipay-confirm-dropzone-text-color: <?php echo esc_html($formipay_settings['bank_transfer_confirmation_dropzone_text_color']) ?? '#808080'; ?>;
|
||||
<?php
|
||||
switch (formipay_get_post_meta($form_id, 'thankyou_screen_table_alignment')) {
|
||||
case 'left':
|
||||
?>
|
||||
--formipay-thankyou-table-alignment-left: unset;
|
||||
--formipay-thankyou-table-alignment-right: auto;
|
||||
<?php
|
||||
break;
|
||||
case 'right':
|
||||
?>
|
||||
--formipay-thankyou-table-alignment-left: auto;
|
||||
--formipay-thankyou-table-alignment-right: unset;
|
||||
<?php
|
||||
break;
|
||||
|
||||
default:
|
||||
?>
|
||||
--formipay-thankyou-table-alignment-left: auto;
|
||||
--formipay-thankyou-table-alignment-right: auto;
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
?>
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="formipay-container">
|
||||
<?php
|
||||
$this->view_access();
|
||||
wp_footer();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user