Guys iam working with a school project. its a school management system.
whats my doubt is my application is dynamic, so the fee payment takes two steps,
fee structure and fee payment
first my doubt is in fee structure
the school posses Main category and sub category of fee, like below structure
Term1 payment duration (1-08-2019 to 15-08-2019)
school Fee = 6000
Bus Fee = 3000
Tution Fee= 2500
Term 2 payment duration (1-12-2019 to 15-12-2019)
school Fee = 6000
Lab Fee = 3000
Term3 payment duration (1-03-2020 to 15-08-2020)
School Fee= 6000
extra fee = 2000
like this it goes on,
this structure may varies class wise (1 std 2nd std and so on...)
So for this i planned two tables to add the main category and the sub category.
table main category has columns like
$table->bigIncrements('id');
$table->bigInteger('acc_year_id')->unsigned();
$table->foreign('acc_year_id')->references('id')->on('academic_years')->onDelete('cascade');
$table->string('fee_main_cat');
$table->date('due_start_date')->nullable();
$table->date('due_end_date')->nullable();
$table->bigInteger('total_amt')->nullable();
$table->longText('note')->nullable();
$table->string('status')->nullable();
$table->timestamps();
the view of the above table is : https://imgur.com/Gwo9vYQ
and sub category table has columns below
$table->bigIncrements('id');
$table->bigInteger('acc_year_id')->unsigned();
$table->foreign('acc_year_id')->references('id')->on('academic_years')->onDelete('cascade');
$table->bigInteger('class_id')->unsigned();
$table->foreign('class_id')->references('id')->on('class_details')->onDelete('cascade');
$table->bigInteger('fee_main_cat_id')->unsigned();
$table->foreign('fee_main_cat_id')->references('id')->on('fee_main_cats')->onDelete('cascade');
$table->string('fee_sub_cat');
$table->bigInteger('amt')->nullable();
$table->longText('note')->nullable();
$table->string('status')->nullable();
the view of the above table is : https://imgur.com/bNX2JOR
whether the above columns are right.
so for this i have created a form like this : https://imgur.com/z6AY2xX
in this form to add sub category i used table because for one main category there may be 2 or 3 sub categories.
in some occurrence there may not be any sub categories.
here whats the problem iam facing is, i planned everything, the fee main category which is typed by the user in the form will be added to the main category table, and the id of that is picked, and it is added to the sub categories table with its details. here the problem is i should not enter the main category two times, so used datalist in html, which act as textbox and aswell as dropdown. if data there it shows else user can enter.
but i failed. then only i got confusion.
is one form is enough for both. else need two forms.
kindly suggest your ideas please