Dodanie obsługi danych firmy w formularzach oraz poprawa warunków sprawdzających w kodzie

This commit is contained in:
2025-01-04 12:11:00 +01:00
parent 18dd1718a4
commit 5adfbf5eab
23 changed files with 218 additions and 756 deletions

View File

@@ -51,13 +51,8 @@
<input type="text" id="surname" name="surname" class="form-control" required placeholder="<?= ucfirst( \S::lang( 'nazwisko' ) );?>" value="<?= htmlspecialchars( $address_current['surname'] );?>">
</div>
</div>
<div class="form-group row">
<div class="col-12">
<input type="text" id="firm" name="firm" class="form-control" placeholder="<?= ucfirst( \S::lang( 'firma' ) );?> (<?= \S::lang( 'opcjonalnie' );?>)" value="<?= htmlspecialchars( $address_current['firm'] );?>">
</div>
</div>
<div class="form-group">
<input type="text" id="street" name="street" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" value="<?= htmlspecialchars( $address_current['street'] );?>">
<input type="text" id="street" name="street" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" value="<?= htmlspecialchars( $address_current['street'] );?>">
</div>
<div class="form-group">
<div class="row">
@@ -75,17 +70,51 @@
<img src="/images/system/lang_pl.png" alt="">
<span>+48</span>
</div>
<input
type="tel"
id="phone"
name="phone"
class="form-control form-control-input"
required
placeholder="<?= ucfirst(\S::lang('telefon')); ?>"
value="<?= htmlspecialchars($address_current['phone']); ?>"
pattern="[0-9]{9}">
<input type="tel" id="phone" name="phone" class="form-control form-control-input" required placeholder="<?= ucfirst(\S::lang('telefon')); ?>" value="<?= htmlspecialchars($address_current['phone']); ?>" pattern="[0-9]{9}">
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12" id="fvat">
<input type="checkbox" name="fvat">
<?= \S::lang( 'faktura-vat' );?>
</div>
</div>
</div>
<div class="fvat-data">
<div class="form-group">
<div class="row">
<div class="col-12">
<input type="text" id="firm_name" name="firm_name" class="form-control" placeholder="<?= ucfirst( \S::lang( 'nazwa-firmy' ) );?>" value="">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12">
<input type="text" id="firm_street" name="firm_street" class="form-control" placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?>" value="">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12 col-md-6">
<input type="text" id="firm_postal_code" name="firm_postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" placeholder="<?= ucfirst( \S::lang( 'kod-pocztowy' ) );?>" value="">
</div>
<div class="col-12 col-md-6">
<input type="text" id="firm_city" name="firm_city" class="form-control" placeholder="<?= ucfirst( \S::lang( 'miasto' ) );?>" value="">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12">
<input type="text" id="firm_nip" name="firm_nip" class="form-control" placeholder="<?= ucfirst( \S::lang( 'nip' ) );?>" value="">
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12" id="agreement">
@@ -110,10 +139,11 @@
</div>
<script class="footer">
$(document).ready(function () {
function validatePhone() {
var phone = $('#phone');
var phonePattern = /^[0-9]{9}$/;
if (!phone.val() || !phonePattern.test(phone.val())) {
$('#order-send').prop('disabled', true);
} else {
@@ -128,7 +158,18 @@
validatePhone();
});
$( function() {
$( function()
{
$( 'body' ).on( 'change', 'input[name="fvat"]', function() {
if ( $( this ).is( ':checked' ) ) {
$( '.fvat-data input' ).prop( 'required', true );
$( '.fvat-data' ).slideDown();
} else {
$( '.fvat-data' ).slideUp();
$( '.fvat-data input' ).prop( 'required', false ).val( '' );
}
});
$( 'body' ).on( click_event, '.addresses .address .btn-select', function(e)
{
e.preventDefault();

View File

@@ -15,9 +15,6 @@
<div class="form-group">
<input type="text" name="surname" required class="form-control" placeholder="<?= ucfirst( \S::lang( 'nazwisko' ) );?>" value="<?= htmlspecialchars( $this -> address['surname'] );?>">
</div>
<div class="form-group">
<input type="text" name="firm" class="form-control" placeholder="<?= ucfirst( \S::lang( 'firma' ) );?> (<?= \S::lang( 'opcjonalnie' );?>)" value="<?= htmlspecialchars( $this -> address['firm'] );?>">
</div>
<div class="form-group">
<input type="text" name="street" required class="form-control" placeholder="<?= ucfirst( \S::lang( 'ulica-i-numer' ) );?>" value="<?= htmlspecialchars( $this -> address['street'] );?>">
</div>

View File

@@ -41,6 +41,16 @@ echo $this -> settings['newsletter_header'];
<br /><br />Punkt Orlen: <b><?= $this -> order['orlen_point'];?>
<? endif;?>
</p>
<? if ( $this -> order['firm_name'] ):?>
<div style="border-bottom: 1px solid #eee; margin-bottom: 15px;"></div>
<p style="font-family: Arial; font-size: 14px; font-weight: 600; text-transform: uppercase;"><?= \S::lang( 'dane-do-faktury' );?>:</p>
<p style="font-family: Arial; font-size: 14px; margin-top: 15px;">
<?= $this -> order['firm_name'];?><br />
<?= $this -> order['firm_street'];?><br />
<?= $this -> order['firm_postal_code'];?> <?= $this -> order['firm_city'];?><br />
NIP: <?= $this -> order['firm_nip'];?>
</p>
<? endif;?>
<div style="border-bottom: 1px solid #eee; margin-bottom: 15px;"></div>
<p style="font-family: Arial; font-size: 14px; font-weight: 600; text-transform: uppercase;"><?= \S::lang( 'zamowione-produkty' );?>:</p>
<table style="font-family: Arial; width: 100%; max-width: 800px; border-collapse: collapse; font-size: 14px; margin-bottom: 25px;">

View File

@@ -7,6 +7,35 @@
Status zamówienia: <span><?= $this -> statuses[ $this -> order['status'] ];?></span>
</div>
</div>
<div class="top-second">
<div class="column">
<h5><?= ucfirst( \S::lang( 'dane-do-dostawy' ) );?></h5>
<p>
<?= $this -> order['client_surname'];?> <?= $this -> order['client_name'];?><br />
<?= $this -> order['client_street'];?><br />
<?= $this -> order['client_postal_code'];?> <?= $this -> order['client_city'];?><br />
<?= $this -> order['client_email'];?><br />
<?= $this -> order['client_phone'];?>
<? if ( $this -> order['inpost_paczkomat'] ):?>
<br /><br />Paczkomat: <b><?= $this -> order['inpost_paczkomat'];?>
<? endif;?>
<? if ( $this -> order['orlen_point'] ):?>
<br /><br />Punkt Orlen: <b><?= $this -> order['orlen_point'];?>
<? endif;?>
</p>
</div>
<div class="column">
<? if ( $this -> order['firm_name'] ):?>
<h5><?= \S::lang( 'dane-do-faktury' );?>:</h5>
<p>
<?= $this -> order['firm_name'];?><br />
<?= $this -> order['firm_street'];?><br />
<?= $this -> order['firm_postal_code'];?> <?= $this -> order['firm_city'];?><br />
NIP: <?= $this -> order['firm_nip'];?>
</p>
<? endif;?>
</div>
</div>
<div class="products">
<? if ( is_array( $this -> order['products'] ) and count( $this -> order['products'] ) ):?>
<? foreach ( $this -> order['products'] as $product ):?>

View File

@@ -56,7 +56,7 @@
<div class="price-minimal">
Najniższa cena w ciągu ostatnich 30 dni: <strong><?= \shop\Shop::shortPrice( \front\factory\ShopProduct::get_minimal_price( $this -> product['id'], $this -> product -> price_brutto_promo ) );?> zł</strong>
</div>
<? if ( $this -> product -> weight && $this -> product -> product_unit_id ):?>
<? if ( $this -> product -> weight > 0 && $this -> product -> product_unit_id ):?>
<div class="price_weight">
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto_promo / $this -> product -> wegiht * 1 );?> <?= $this -> product -> product_unit;?>
</div>
@@ -65,7 +65,7 @@
<div class="price">
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto );?> <span class="small">zł</span>
</div>
<? if ( $this -> product -> weight && $this -> product -> product_unit_id ):?>
<? if ( $this -> product -> weight > 0 && $this -> product -> product_unit_id ):?>
<div class="price_weight">
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto / $this -> product -> weight );?> <span class="small">zł</span> / <?= \front\factory\Dictionaries::get_name_by_id( $this -> product -> product_unit_id, $this -> lang_id );?>
</div>