|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/indolok.id/application/views/admin/products/ |
Upload File : |
<div class="row">
<div class="col-sm-12">
<a href="<?= base_url('admin/products'); ?>">
<i class="fa fa-arrow-left" aria-hidden="true"></i> Kembali ke Produk
</a><br><br>
<h4><?= empty($products->id_products) ? 'Tambah produk baru' : 'Edit Produk: '
. $products->title; ?></h4>
<?= $this->session->flashdata('success'); //to display success message ?>
<?= $this->session->flashdata('result'); //to display result message ?>
</div><!-- end class="col-sm-12" -->
</div> <!-- end row -->
<?= form_open_multipart(); ?>
<!-- <p style="text-align:right;"><?= form_submit('submit', 'Simpan Produk', 'class="btn btn-primary btn-success button-brown"'); ?> <?= anchor('admin/products', 'batal'); ?></p><br>
<input type="hidden" name="product_id" value="<?= $products->id_products; ?>"> -->
<br>
<div class="row">
<div class="col-sm-3">
<!-- <p>Kode Produk*</p> -->
<p>Item Number*</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<p>
<?php
$data = array(
'name' => 'product_code',
'value' => set_value('product_code', $products->product_code),
'class' => 'form-control',
'required' => 'required'
);
echo form_input($data);
?>
<?= form_error('product_code'); ?>
</p>
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-3">
<p>SKU*</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<p>
<?php
$data = array(
'name' => 'sku',
'value' => set_value('sku', $products->sku),
'class' => 'form-control',
'required' => 'required'
);
echo form_input($data);
?>
<?= form_error('sku'); ?>
</p>
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-3">
<p>Nama Produk*</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<p>
<?php
$data = array(
'name' => 'product_name',
'value' => set_value('product_name', $products->title, FALSE),
'class' => 'form-control',
'required' => 'required'
);
echo form_input($data);
?>
<?= form_error('product_name'); ?>
</p>
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-3">
<p>Harga Jual Normal*</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<p>
<?php
$data = array(
'name' => 'sale_price',
'value' => set_value('sale_price', $products->sale_price),
'class' => 'form-control',
'required' => 'required'
);
echo form_input($data);
?>
<?= form_error('sale_price'); ?>
</p>
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-3">
<p>Harga Jual Diskon</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<p>
<?php
$data = array(
'name' => 'discounted_price',
'value' => set_value('discounted_price', $products->discounted_price),
'class' => 'form-control',
);
echo form_input($data);
?>
<?= form_error('discounted_price'); ?>
</p>
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<?php if($role =='super admin') : ?>
<div class="row">
<div class="col-sm-3">
<p>Stok</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Gudang</th>
<th>Stok</th>
</tr>
</thead>
<tbody>
<?php foreach ($stock as $stock_item):?>
<tr>
<td style="width: 50%"><?= $stock_item->name; ?></td>
<input type="hidden" name="warehouse_id[]" value="<?= $stock_item->id;?>">
<?php if ($new_product == 'yes'): ?>
<td><input type="text" value="0" style="padding: 5px;"></td>
<?php else: ?>
<?php
$product_stock = 0;
$get_stock = $this->db->select('stock')->from('stock')->where('id_product',$products->id_products)->where('Warehouse_id',$stock_item->id)->get()->row();
if($get_stock!=null){
$product_stock = $get_stock->stock;
}
?>
<td><input type="number" min="0" name="warehouse_stock[]" value="<?= $product_stock; ?>" style="padding: 5px;"></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!-- end class responsive-->
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<?php else : ?>
<div class="row">
<div class="col-sm-3">
<p>Stok</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Gudang</th>
<th>Stok</th>
</tr>
</thead>
<tbody>
<?php foreach ($stock as $stock_item):?>
<tr>
<td style="width: 50%"><?= $stock_item->name; ?></td>
<?php if ($new_product == 'yes'): ?>
<td><input type="text" value="0" style="padding: 5px;" disabled></td>
<?php else: ?>
<?php
$product_stock = 0;
$get_stock = $this->db->select('stock')->from('stock')->where('id_product',$products->id_products)->where('Warehouse_id',$stock_item->id)->get()->row()->stock;
if($get_stock!=null){
$product_stock = $get_stock;
}
?>
<td><input type="text" value="<?= $product_stock; ?>" style="padding: 5px;" disabled></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!-- end class responsive-->
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<?php endif; ?>
<div class="row">
<div class="col-sm-3">
<p>Ordering (masukan angka)</p>
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<p>
<?php
$data = array(
'name' => 'priority',
'value' => $products->priority,
'class' => 'form-control'
);
echo form_input($data); ?>
<?= form_error('priority'); ?></p>
</div><!-- end class="col-sm-9" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-3">
</div><!-- end class="col-sm-3" -->
<div class="col-sm-9">
<?php if($allowed == true) : ?>
<?= form_submit('submit', 'Simpan Produk', 'class="btn btn-primary btn-success button-brown"'); ?>
<?= anchor('admin/products', 'batal'); ?>
<?php endif; ?>
</div><!-- end class="col-sm-9" -->
</div><!--end row -->
<?= form_close(); ?>
<script>
$(document).ready(function() {
$('form').submit(function(e){
for (var i=1; i<=3; i++) {
if($('#checkbox_satuanbeli' + i).is(':checked')) {
//check if #input_satuanbeli has value
if($('#input_satuanbeli' + i).val() == '' || $('#input_satuanbeli' + i).val() == '0') {
alert ('Satuan beli yang dicentang tidak boleh kosong atau 0. Cek kembali Satuan beli.');
$('#input_satuanbeli' + i).focus();
e.preventDefault();
return false;
}
}
}
});
});
</script>