added dropdown features in material module -vadivel J
This commit is contained in:
parent
4b64e8dfc8
commit
05096d86c5
@ -8,6 +8,8 @@ use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
|
||||
use App\Models\Rawmaterialdetails_model;
|
||||
|
||||
use App\Models\MaterialCategoriesModel;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
@ -26,6 +28,7 @@ use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
class Rawmaterialdetails extends BaseController
|
||||
{
|
||||
protected $rawmaterialdetails_model;
|
||||
protected $materialCategories_model;
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
@ -34,7 +37,8 @@ class Rawmaterialdetails extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->rawmaterialdetails_model = new Rawmaterialdetails_model();;
|
||||
$this->rawmaterialdetails_model = new Rawmaterialdetails_model();
|
||||
$this->materialCategories_model = new MaterialCategoriesModel();
|
||||
$this->session = session();
|
||||
helper('form'); //$this->load->library('form_validation');
|
||||
// $this->load->library('pagination');
|
||||
@ -90,6 +94,7 @@ class Rawmaterialdetails extends BaseController
|
||||
$this->rawmaterialdetails_model = new rawmaterialdetails_model();;
|
||||
$data['material'] = $this->rawmaterialdetails_model->getmaterialType();
|
||||
$data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory();
|
||||
$data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll();
|
||||
$data['UOM'] = $this->rawmaterialdetails_model->getUOM();
|
||||
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
|
||||
$data['costcentercode'] = $this->rawmaterialdetails_model->getcostcentercode();
|
||||
@ -241,6 +246,7 @@ class Rawmaterialdetails extends BaseController
|
||||
$data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID, $currentdate);
|
||||
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType);
|
||||
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
|
||||
$data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll();
|
||||
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
|
||||
$data['costcentercode'] = $this->rawmaterialdetails_model->getCostCenterCode();
|
||||
$data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM();
|
||||
|
||||
62
app/Models/MaterialCategoriesModel.php
Normal file
62
app/Models/MaterialCategoriesModel.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class MaterialCategoriesModel extends Model
|
||||
{
|
||||
protected $table = 't_materialCategories';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['category_name', 'is_active'];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
protected bool $updateOnlyChanged = true;
|
||||
|
||||
protected array $casts = [];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
// Validation
|
||||
protected $validationRules = [
|
||||
'category_name' => 'required|max_length[255]',
|
||||
|
||||
];
|
||||
protected $validationMessages = [
|
||||
'category_name' => [
|
||||
'required' => 'The category name is required.',
|
||||
'max_length' => 'The category name cannot exceed 255 characters.'
|
||||
],
|
||||
|
||||
];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
|
||||
//all methods starts from here
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -69,6 +69,8 @@ class Rawmaterialdetails_model extends Model
|
||||
return $query->getResult();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//This function used to get the conversionfactor using configdetails table
|
||||
function getConversionfactorUOM($ConversionFactorUOM = '')
|
||||
{
|
||||
@ -116,8 +118,6 @@ class Rawmaterialdetails_model extends Model
|
||||
*/
|
||||
function getMaterialDetails($MaterialCode)
|
||||
{
|
||||
|
||||
|
||||
$sql = " SELECT * FROM t_materialmaster WHERE MaterialCode ='$MaterialCode'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->getResult();
|
||||
|
||||
@ -66,10 +66,23 @@
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="col-form-label" for="MaterialCaterogy">Material Caterogy<span class="badge">*</span></label>
|
||||
<input type="text" class="form-control required " required id="MatCate" name="MatCate" maxlength="255">
|
||||
|
||||
<div class=" col-md-3">
|
||||
<label class="col-form-label" for="MatCate">Material Caterogy<span class="badge">*</span></label>
|
||||
<select class="form-control select2" required id="MatCate" name="MatCate">
|
||||
<option value="" required>Select Material Caterogy </option>
|
||||
<?php
|
||||
if (!empty($materialCategoryList)) {
|
||||
foreach ($materialCategoryList as $record) {
|
||||
?>
|
||||
<option value="<?php echo $record['category_name']?>"><?php echo $record['category_name']?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="col-form-label" for="UnitofMeasurement">Unit of Measurement<span class="badge">*</span></label>
|
||||
<select class="form-control required select2" id="UOM" name="UOM">
|
||||
@ -178,22 +191,23 @@
|
||||
//var tempARRAY = [];
|
||||
$(document).ready(function() {
|
||||
$("#MaterialType").select2();
|
||||
$('#MatCate').select2();
|
||||
|
||||
// $("#MaterialCategory").select2();
|
||||
$("#UOM").select2();
|
||||
$('#MatCate').autocomplete({
|
||||
// $('#MatCate').autocomplete({
|
||||
|
||||
onSearchStart: function(query) {
|
||||
//alert(query);
|
||||
$('#MatCate').autocomplete("option", "minLength", 0);
|
||||
},
|
||||
// onSearchStart: function(query) {
|
||||
// //alert(query);
|
||||
// $('#MatCate').autocomplete("option", "minLength", 0);
|
||||
// },
|
||||
|
||||
serviceUrl: "<?php echo base_url(); ?>rawmaterialdetailsautocomplete",
|
||||
onSelect: function(suggestion) {
|
||||
var data = suggestion.ConfigValue;
|
||||
// serviceUrl: "<?php echo base_url(); ?>rawmaterialdetailsautocomplete",
|
||||
// onSelect: function(suggestion) {
|
||||
// var data = suggestion.ConfigValue;
|
||||
|
||||
}
|
||||
});
|
||||
// }
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -159,13 +159,28 @@ if ($total <= $reorder) {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="MaterialCategory">Material Category <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory; ?>" maxlength="255" required>
|
||||
<select class="form-control select2" id="MaterialCategory" name="MaterialCategory" required>
|
||||
<?php
|
||||
if (!empty($materialCategoryList)) {
|
||||
foreach ($materialCategoryList as $record) {
|
||||
?>
|
||||
<option value="<?= $record['category_name'] ?>" <?php if ($record['category_name'] === $MaterialCategory) echo "selected"; ?>>
|
||||
<?php echo $record['category_name'] ?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-row mb-3">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
@ -286,6 +301,7 @@ if ($total <= $reorder) {
|
||||
|
||||
$("#UOM").select2();
|
||||
$("#MaterialType").select2();
|
||||
$("#MaterialCategory").select2();
|
||||
/** ---- auto search code -------- */
|
||||
$('#MaterialCategory').autocomplete({
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user