File manager - Edit - /home/autoph/public_html/connectv1/brand_model.php
Back
<?php include('cfg/db.php'); // include('app/security/security.php'); // include('api/controllers/utility.php'); if(!isset($_SESSION['user']['id'])){ header('location:signin.php'); } if(!(isset($global_action_permissions['4']['22']) && in_array("1", $global_action_permissions['4']['22']))){ header('location:signin.php'); } $signup_arr = array(); $signup_query = $db -> return_result("SELECT `title`, `content` FROM `settings_legals` WHERE `name` = 'signup'"); foreach($signup_query as $data){ $signup_arr['title'] = $data['title']; $signup_arr['content'] = $data['content']; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $variable['site_name']; ?> | Brand & Model</title> <!-- Google Font: Source Sans Pro --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"> <!-- Font Awesome --> <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css"> <!-- Theme style --> <link rel="stylesheet" href="dist/css/adminlte.min.css"> <!-- overlayScrollbars --> <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css"> <!-- SweetAlert2 --> <link rel="stylesheet" href="plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css"> <!-- Toastr --> <link rel="stylesheet" href="plugins/toastr/toastr.min.css"> <!--Bootstrap Table--> <link href="plugins/bootstrap-table/css/bootstrap-table.min.css" rel="stylesheet"> <!-- Select2 --> <link rel="stylesheet" href="plugins/select2/css/select2.min.css"> <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css"> <link href="dist/img/<?php echo $variable['logo']; ?>" rel="icon"/> <style> .form-div { margin-top: 100px; border: 1px solid #e0e0e0; } #brand-image { display: block; height: 160px; width: 160px; margin: 0px auto; border-radius: 50%; } .img-placeholder { width: 160px; color: white; height: 160px; background: black; opacity: .7; border-radius: 50%; z-index: 2; position: absolute; left: 50%; transform: translateX(-50%); display: none; } .img-placeholder h4 { margin-top: 40%; color: white; } .img-div:hover .img-placeholder { display: block; cursor: pointer; } table th { cursor:default; } fieldset { margin-left: 2px; margin-right: 2px; padding-top: 0.35em; padding-bottom: 0.625em; padding-left: 0.75em; padding-right: 0.75em; border: 1px solid gray; border-radius: 3%; } legend { font-size: 100%; font-weight: bold; color: blue; } .span-labels { font-size: 90%; font-style: italic; } .span-values { font-size: 90%; } .big-letter { text-transform: uppercase; } </style> </head> <body class="hold-transition sidebar-mini text-sm layout-fixed"> <div class="wrapper"> <!-- INCLUDE HEADER --> <?php include('include/header.php'); ?> <?php include('include/sidebar.php'); ?> <!-- /.navbar --> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1>Brand & Model</h1> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="home.php">Home</a></li> <li class="breadcrumb-item active">Brand & Model</li> </ol> </div> </div> </div><!-- /.container-fluid --> </section> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="card card-primary card-tabs"> <div class="card-header p-0 pt-1"> <ul class="nav nav-tabs" id="custom-tabs-one-tab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="custom-tabs-one-modify-tab" data-toggle="pill" href="#custom-tabs-one-modify" role="tab" aria-controls="custom-tabs-one-modify" aria-selected="false">Modification</a> </li> <li class="nav-item"> <a class="nav-link" id="custom-tabs-one-settings-tab" data-toggle="pill" href="#custom-tabs-one-settings" role="tab" aria-controls="custom-tabs-one-settings" aria-selected="false">Settings</a> </li> </ul> </div> <div class="card-body"> <div class="tab-content" id="custom-tabs-one-tabContent"> <div class="tab-pane fade show active" id="custom-tabs-one-modify" role="tabpanel" aria-labelledby="custom-tabs-one-modify-tab"> <!-- <div style="height: 100%;"> --> <div class="card-body"> <div class="row"> <div> <input type="button" id="add-button" value="Add New" data-toggle="" data-target="" class="float-right btn btn-primary btn-xs"> </div><!--form-group--> </div> <div class="row"> <div class="col-sm-4 mt-3"> <div class="form-group"> <div class="row"> <div class="col-sm-8"> <label>Brand</label> </div> <div class="col-sm-4"> <input type="text" name="modify-search-brand" id="modify-search-brand" placeholder="Search" class="form-control form-control-sm"> </div> </div> <div class="mt-1"> <select id="modify-brand-list" size="5" class="form-control form-control-sm"> </select> </div> </div> <div id="brand-image-div" class="form-group text-center" style="position: relative;"> <span class="img-div"> <div class="text-center img-placeholder" onClick="triggerClick()"> <h4>Update image</h4> </div> <img class="brand-img img-fluid img-circle" src="dist/img/brand/default.png" onClick="triggerClick()" id="brand-image"> </span> <input accept=".png,.jpeg,.jpg" type="file" name="file" onChange="displayImageBrand(this)" id="file" class="form-control" style="display: none;"> </div> </div> <div class="col-sm-8"> <fieldset class="card"> <legend>Brand Details</legend> <div class="row mb-2"> <div class="col-sm-12"> <div class="form-group form-control-sm"> <label class="lbl-forms mx-0 my-0">Brand Name</label> <input id="details-brand-name" type="text" class="big-letter lbl-forms-sm form-control form-control-sm" style="background-color: transparent;"> </div> </div> </div> <div class="row"> <div class="col-sm-4 mt-4"> <div class="form-group"> <span class="span-labels"><strong>Added by:  </strong></span><br> <span id="details-brand-added-by" class="span-values"></span> </div> </div> <div class="col-sm-4 mt-4"> <div class="form-group"> <!-- <span class="span-labels"><strong>Last modified by:  </strong></span><br> <span id="details-company-last-modified-by" class="span-values"></span> --> </div> </div> <div class="col-sm-4 mt-4"> <div class="form-group"> <span class="span-labels"><strong>Date added:  </strong></span><br> <span id="details-brand-date-added" class="span-values"></span> </div> </div> </div> <br> <div class="row"> <div class="col-8"> <div class="alert alert-info" role="alert" id="modify-company-error-alert" style="display: none;"> <span id="modify-company-error-icon" class="icon fas fa-info" style="margin-top: -20%;"> </span> <span id="modify-company-alert-message"></span></a> </div> </div> <div class="col-4"> <div class="form-group"> <input type="button" name="details-update-brand" id="details-update-brand" value="Update" class="float-right btn btn-success btn-xs"> </div><!--form-group--> </div> </div> </fieldset> </div> </div> </div> <hr> <div class="card-body"> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <div class="row"> <div class="col-sm-8"> <label>Model</label> </div> <div class="col-sm-4"> <input type="text" name="modify-search-model" id="modify-search-model" placeholder="Search" class="form-control form-control-sm"> </div> </div> <div class="mt-1"> <select id="modify-model-list" size="5" class="form-control form-control-sm"> </select> </div> </div> </div> <div class="col-sm-8"> <fieldset class="card"> <legend>Model Details</legend> <div class="row mb-2"> <div class="col-sm-4"> <div class="form-group form-control-sm"> <label class="lbl-forms mx-0 my-0">Model's Brand</label> <select id="modify-dd-models-brand" class="form-control form-control-sm"> </select> </div> </div> <div class="col-sm-8"> <div class="form-group form-control-sm"> <label class="lbl-forms mx-0 my-0">Name</label> <input id="details-model-name" type="text" class="lbl-forms-sm form-control form-control-sm" style="background-color: transparent;"> </div> </div> </div> <div class="row"> <div class="col-sm-4 mt-4"> <div class="form-group"> <span class="span-labels"><strong>Added by:  </strong></span><br> <span id="details-model-added-by" class="span-values"></span> </div> </div> <div class="col-sm-4 mt-4"> <div class="form-group"> <!-- <span class="span-labels"><strong>Last modified by:  </strong></span><br> <span id="details-dealer-last-modified-by" class="span-values"></span> --> </div> </div> <div class="col-sm-4 mt-4"> <div class="form-group"> <span class="span-labels"><strong>Date added:  </strong></span><br> <span id="details-model-date-added" class="span-values"></span> </div> </div> </div> <div class="row"> <div class="col-8"> <div class="alert alert-info" role="alert" id="modify-dealer-error-alert" style="display: none;"> <span id="modify-dealer-error-icon" class="icon fas fa-info" style="margin-top: -20%;"> </span> <span id="modify-dealer-alert-message"></span></a> </div> </div> <div class="col-4"> <div class="form-group"> <input type="button" name="details-update-model" id="details-update-model" value="Update" class="float-right btn btn-success btn-xs"> </div><!--form-group--> </div> </div> </fieldset> </div> </div> </div> <hr> <div class="card-body"> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <div class="row"> <div class="col-sm-8"> <label>Variant</label> </div> <div class="col-sm-4"> <input type="text" name="modify-search-variant" id="modify-search-variant" placeholder="Search" class="form-control form-control-sm"> </div> </div> <div class="mt-1"> <select id="modify-variant-list" size="5" class="form-control form-control-sm"> </select> </div> </div> </div> <div class="col-sm-8"> <fieldset class="card"> <legend>Variant Details</legend> <div class="row mb-2"> <div class="col-sm-4"> <div class="form-group form-control-sm"> <label class="lbl-forms mx-0 my-0">Variant's Model</label> <select id="modify-dd-variants-model" class="form-control form-control-sm"> </select> </div> </div> <div class="col-sm-8"> <div class="form-group form-control-sm"> <label class="lbl-forms mx-0 my-0">Name</label> <input id="details-variant-name" type="text" class="lbl-forms-sm form-control form-control-sm" style="background-color: transparent;"> </div> </div> </div> <div class="row"> <div class="col-sm-4 mt-4"> <div class="form-group"> <span class="span-labels"><strong>Added by:  </strong></span><br> <span id="details-variant-added-by" class="span-values"></span> </div> </div> <div class="col-sm-4 mt-4"> <div class="form-group"> <!-- <span class="span-labels"><strong>Last modified by:  </strong></span><br> <span id="details-dealer-last-modified-by" class="span-values"></span> --> </div> </div> <div class="col-sm-4 mt-4"> <div class="form-group"> <span class="span-labels"><strong>Date added:  </strong></span><br> <span id="details-variant-date-added" class="span-values"></span> </div> </div> </div> <div class="row"> <div class="col-8"> <div class="alert alert-info" role="alert" id="modify-dealer-error-alert" style="display: none;"> <span id="modify-dealer-error-icon" class="icon fas fa-info" style="margin-top: -20%;"> </span> <span id="modify-dealer-alert-message"></span></a> </div> </div> <div class="col-4"> <div class="form-group"> <input type="button" name="details-update-variant" id="details-update-variant" value="Update" class="float-right btn btn-success btn-xs"> </div><!--form-group--> </div> </div> </fieldset> </div> </div> </div> <!-- </div> --> </div> <!--modify tab--> <div class="tab-pane fade show" id="custom-tabs-one-settings" role="tabpanel" aria-labelledby="custom-tabs-one-settings-tab"> <div style="height: 100%;"> <div class="card-body"> <fieldset class="card"> <div id="brand-table-list" class="table-responsive"> <table id="brand-activation-table" class="table table-sm" data-toggle="table" data-url="app/table/brand_table_list.php" data-pagination="true" data-search="true" data-show-refresh="true" data-show-toggle="false" data-show-columns="false" data-show-columns-toggle-all="false" data-show-export="false" data-side-pagination="server" data-page-list="[10, 25, all]" data-minimum-count-columns="2" data-show-pagination-switch="false" data-pagination="true" data-query-params="queryParamsBrandTable" data-click-to-select="true" > <thead> <tr> <th class="main-header-table" data-formatter="" data-field="name">Brand Name</th> <th class="main-header-table" data-formatter="" data-field="added_by">Added By</th> <th class="main-header-table" data-field="date_added">Date Created</th> <th class="main-header-table" data-align="center" data-formatter="brandStatusFormatter" data-events="roleEventsBrand" data-field="status">Status</th> </tr> </thead> </table> </fieldset> <hr> <fieldset class="card"> <div id="model-table-list" class="table-responsive"> <table id="model-activation-table" class="table table-sm" data-toggle="table" data-url="app/table/model_table_list.php" data-pagination="true" data-search="true" data-show-refresh="true" data-show-toggle="false" data-show-columns="false" data-show-columns-toggle-all="false" data-show-export="false" data-side-pagination="server" data-page-list="[10, 25, all]" data-minimum-count-columns="2" data-show-pagination-switch="false" data-pagination="true" data-query-params="queryParamsModelTable" data-click-to-select="true" > <thead> <tr> <th class="main-header-table" data-formatter="" data-field="model_name">Model Name</th> <th class="main-header-table" data-formatter="" data-field="brand_name">Model's Brand</th> <th class="main-header-table" data-formatter="" data-field="added_by">Added By</th> <th class="main-header-table" data-field="date_added">Date Created</th> <th class="main-header-table" data-align="center" data-formatter="modelStatusFormatter" data-events="roleEventsModel" data-field="status">Status</th> </tr> </thead> </table> </div> </fieldset> <hr> <fieldset class="card"> <div id="variant-table-list" class="table-responsive"> <table id="variant-activation-table" class="table table-sm" data-toggle="table" data-url="app/table/variant_table_list.php" data-pagination="true" data-search="true" data-show-refresh="true" data-show-toggle="false" data-show-columns="false" data-show-columns-toggle-all="false" data-show-export="false" data-side-pagination="server" data-page-list="[10, 25, all]" data-minimum-count-columns="2" data-show-pagination-switch="false" data-pagination="true" data-query-params="queryParamsVariantTable" data-click-to-select="true" > <thead> <tr> <th class="main-header-table" data-formatter="" data-field="variant_name">Variant Name</th> <th class="main-header-table" data-formatter="" data-field="model_name">Variant's Model</th> <th class="main-header-table" data-formatter="" data-field="added_by">Added By</th> <th class="main-header-table" data-field="date_added">Date Created</th> <th class="main-header-table" data-align="center" data-formatter="variantStatusFormatter" data-events="roleEventsVariant" data-field="status">Status</th> </tr> </thead> </table> </div> </fieldset> </div> </div> </div><!--settings tab--> </div> </div> </div> </div><!-- /.container-fluid --> <!--------------------------------------------------------- Modal --> <!-- Add brand --> <div class="modal fade" id="modal-add-brand" tabindex="-1" data-backdrop="static" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-md" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalCenterTitle"><span id="modal-title">ADD BRAND</span></h5> <div class="fas fa-2x fa-sync-alt fa-spin customer-modal-overlay" hidden></div> <button id="close-modal" type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <div class="form-group dropdown-input" > <label class="lbl-forms mx-0 my-0">Brand Name</label> <input type="text" name="new-brand-name" id="new-brand-name" placeholder="Enter new brand" maxlength="50" class="big-letter form-control form-control-sm"> </div><!--form-group dropdown--> </div><!--form-group--> </div> </div> <div class="row mt-5"> <div class="col-md-12"> <div class="form-group"> <input type="button" name="submit-brand" id="submit-brand" value="Add New Brand" class="float-right btn btn-success btn-xs"> </div><!--form-group--> </div><!--form-group--> </div> </div><!--modal body--> </div><!--modal content--> </div> </div> <!-- Add model --> <div class="modal fade" id="modal-add-model" tabindex="-1" data-backdrop="static" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-md" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalCenterTitle"><span id="modal-title">ADD MODEL</span></h5> <div class="fas fa-2x fa-sync-alt fa-spin customer-modal-overlay" hidden></div> <button id="close-modal" type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="row"> <div class="col-sm-4"> <div id="div-mod-gender" class="form-group"> <div class="form-group"> <select name="add-dd-models-brand" id="add-dd-models-brand" class="modal-select2 edit-customer form-control form-control-sm" style="width: 100%;"> <option value="" disabled selected hidden>SELECT MODEL'S BRAND</option> </select> </div> </div> </div> <div class="col-sm-12"> <div class="form-group"> <div class="form-group dropdown-input" > <input type="text" name="new-model-description" id="new-model-name" placeholder="Enter new model" maxlength="100" class="big-letter form-control form-control-sm"> </div><!--form-group dropdown--> </div><!--form-group--> </div> </div><!--row--> <div class="row"> <div class="col-md-12"> <div class="form-group"> <input type="submit" name="submit-model" id="submit-model" value="Add New Model" class="float-right btn btn-success btn-xs"> </div><!--form-group--> </div><!--form-group--> </div> </div><!--modal body--> </div><!--modal content--> </div> </div> <!-- Add variant --> <div class="modal fade" id="modal-add-variant" tabindex="-1" data-backdrop="static" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-md" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalCenterTitle"><span id="modal-title">ADD MODEL VARIANT</span></h5> <div class="fas fa-2x fa-sync-alt fa-spin customer-modal-overlay" hidden></div> <button id="close-modal" type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="row"> <div class="col-sm-4"> <div id="div-mod-gender" class="form-group"> <div class="form-group"> <select name="add-dd-variants-brand" id="add-dd-variants-brand" class="modal-select2 edit-customer form-control form-control-sm" style="width: 100%;"> <option value="" disabled selected hidden>SELECT BRAND</option> </select> </div> </div> </div> <div class="col-sm-6"> <div id="div-mod-gender" class="form-group"> <div class="form-group"> <select name="add-dd-variants-model" id="add-dd-variants-model" class="modal-select2 edit-customer form-control form-control-sm" style="width: 100%;"> <option value="" disabled selected hidden>SELECT MODEL</option> </select> </div> </div> </div> <div class="col-sm-12"> <div class="form-group"> <div class="form-group dropdown-input" > <input type="text" name="new-variant-name" id="new-variant-name" placeholder="Enter variant" maxlength="100" class="big-letter form-control form-control-sm"> </div><!--form-group dropdown--> </div><!--form-group--> </div> </div><!--row--> <div class="row"> <div class="col-md-12"> <div class="form-group"> <input type="submit" name="submit-variant" id="submit-variant" value="Add Variant" class="float-right btn btn-success btn-xs"> </div><!--form-group--> </div><!--form-group--> </div><!--row--> </div><!--modal body--> </div><!--modal content--> </div> </div> </section> </div><!-- ./cointent-wrapper --> <?php include('include/footer.php'); ?> <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Control sidebar content goes here --> </aside> <!-- /.control-sidebar --> </div><!-- ./wrapper --> <!-- jQuery --> <script src="plugins/jquery/jquery.min.js"></script> <!-- overlayScrollbars --> <script src="plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script> <!-- Bootstrap 4 --> <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- bs-custom-file-input --> <script src="plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script> <!-- AdminLTE App --> <script src="dist/js/adminlte.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="dist/js/demo.js"></script> <!-- Navigation Highlight --> <script src="dist/js/main.js"></script> <!-- SweetAlert2 --> <script src="plugins/sweetalert2/sweetalert2.min.js"></script> <!-- Toastr --> <script src="plugins/toastr/toastr.min.js"></script> <!-- Balloon --> <script src="dist/js/jquery.balloon.min.js"></script> <!-- Select2 --> <script src="plugins/select2/js/select2.full.min.js"></script> <script src="plugins/bootstrap-table/js/tableExport.min.js"></script> <script src="plugins/bootstrap-table/js/bootstrap-table.min.js"></script> <script src="plugins/bootstrap-table/js/bootstrap-table-en-US.js"></script> <script src="plugins/bootstrap-table/js/bootstrap-table-export.min.js"></script> <script> var modify_brand_id_selected = ""; var modify_model_id_selected = ""; var modify_variant_id_selected = ""; var brand_form_data; var image_is_clicked = 0; </script> <script> $(function(){ refreshAddBrandDropdown(); refreshModifyBrandDropdown(); refreshModifyBrandList(); refreshBrandTable(); refreshModelTable(); $('#details-update-brand').attr('disabled', true); $('#details-brand-name').attr('disabled', true); $('#details-model-name').attr('disabled', true); $('#modify-dd-models-brand').attr('disabled', true); $('#details-update-model').attr('disabled', true); $('#modify-dd-variants-model').attr('disabled', true); $('#details-variant-name').attr('disabled', true); $('#details-update-variant').attr('disabled', true); $('#brand-image-div').hide(); }); $(document).mouseup(function(e) { var container = $("#add-button"); // if the target of the click isn't the container nor a descendant of the container if (!container.is(e.target) && container.has(e.target).length === 0) { container.hideBalloon(); shown = !shown; } }); $('#add-dd-models-brand').select2({ placeholder: "Select brand", allowClear: true }) $('#add-dd-variants-brand').select2({ placeholder: "Select brand", allowClear: true }) $('#add-dd-variants-model').select2({ placeholder: "Select model", allowClear: true }) $('#modify-dd-brands-dealer').select2({ placeholder: "Select dealer", allowClear: true }) </script> <script> function queryParamsBrandTable(params) { return { search: params.search, offset: params.offset, limit: params.limit }; } function queryParamsModelTable(params) { return { search: params.search, offset: params.offset, limit: params.limit }; } function queryParamsVariantTable(params) { return { search: params.search, offset: params.offset, limit: params.limit }; } </script> <script> function refreshAddBrandDropdown(){ $.ajax({ url:"app/brand_model/reload_brand.php", type:"POST", //dataType:"json", data: { type: 1 }, beforeSend: function(){ }, success: function(result){ $('#add-dd-models-brand').html(''); $('#add-dd-models-brand').append("<option value=''>SELECT MODEL\'S BRAND</option>"); $('#add-dd-models-brand').append("\"" + result + "\""); $('#add-dd-variants-brand').html(''); $('#add-dd-variants-brand').append("<option value=''>SELECT BRAND</option>"); $('#add-dd-variants-brand').append("\"" + result + "\""); } }); } function refreshModifyBrandDropdown(){ $.ajax({ url:"app/brand_model/reload_brand.php", type:"POST", //dataType:"json", data: { type: 1 }, beforeSend: function(){ }, success: function(result){ $('#modify-dd-models-brand').html(''); $('#modify-dd-models-brand').append("<option value=''>SELECT MODEL\'S BRAND</option>"); $('#modify-dd-models-brand').append("\"" + result + "\""); } }); } function refreshModifyBrandList(){ $.ajax({ url:"app/brand_model/reload_brand.php", type:"POST", //dataType: 'json', data: { type: 1 //populate brand list }, beforeSend: function(){ }, success: function(result){ $('#modify-brand-list').html(''); $('#modify-brand-list').append("\"" + result + "\""); } }); } function refreshModifyModelList(){ $.ajax({ url:"app/brand_model/reload_model.php", type:"POST", //dataType: 'json', data: { brand_id: modify_brand_id_selected, type: 3 //load brand's model list (Model Details) }, beforeSend: function(){ }, success: function(result) { $('#modify-model-list').html(''); $('#modify-model-list').append("\"" + result + "\""); $('#modify-dd-variants-model').html(''); $('#modify-dd-variants-model').append("\"" + result + "\""); }, }) } function refreshModifyVariantList(){ $.ajax({ url:"app/brand_model/reload_variant.php", type:"POST", //dataType: 'json', data: { model_id: modify_model_id_selected, type: 3 //load model's variant list (Variant Details) }, beforeSend: function(){ }, success: function(result) { $('#modify-variant-list').html(''); $('#modify-variant-list').append("\"" + result + "\""); }, }) } function clearAddTabBrand(){ $('#new-brand-name').val(""); } function clearAddTabModel(){ $('#add-dd-models-brand').val(""); $('#new-model-name').val(""); $('#new-model-description').val(""); } function clearModificationTabBrand(){ modify_brand_id_selected = ""; $('#details-brand-name').val(""); $('#details-brand-added-by').text(""); $('#details-brand-date-added').text(""); //document.getElementById("modify-brand-list").selectedIndex = -1; } function clearModificationTabModel(){ modify_model_id_selected = ""; $('#modify-dd-models-brand').val(""); $('#details-model-name').val(""); $('#details-model-added-by').text(""); $('#details-model-date-added').text(""); document.getElementById("modify-model-list").selectedIndex = -1; //$('#modify-model-list').html(''); } function clearModificationTabVariant(){ modify_variant_id_selected = ""; $('#modify-dd-variants-model').val(""); $('#details-variant-name').val(""); $('#details-variant-added-by').text(""); $('#details-variant-date-added').text(""); //document.getElementById("modify-variant-list").selectedIndex = -1; //$('#modify-variant-list').html(''); } function delay(callback, ms) { var timer = 0; return function() { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } function refreshBrandTable() { var $brand_table = $('#brand-activation-table') $(function() { $brand_table.bootstrapTable('refresh', { url: 'app/table/brand_table_list.php' }); }) } function refreshModelTable() { var $model_table = $('#model-activation-table') $(function() { $model_table.bootstrapTable('refresh', { url: 'app/table/model_table_list.php' }); }) } function refreshVariantTable() { var $variant_table = $('#variant-activation-table') $(function() { $variant_table.bootstrapTable('refresh', { url: 'app/table/variant_table_list.php' }); }) } function brandStatusFormatter(value, row, index){ var halaga = value; if(halaga == "1"){ return '<input class="brandStatus" name="brandStatus" id="brandStatus" type="checkbox" checked>'; } else if(halaga == "0"){ return '<input class="brandStatus" name="brandStatus" id="brandStatus" type="checkbox">'; } } function modelStatusFormatter(value, row, index){ var halaga = value; if(halaga == "1"){ return '<input class="modelStatus" name="modelStatus" id="modelStatus" type="checkbox" checked>'; } else if(halaga == "0"){ return '<input class="modelStatus" name="modelStatus" id="modelStatus" type="checkbox">'; } } function variantStatusFormatter(value, row, index){ var halaga = value; if(halaga == "1"){ return '<input class="variantStatus" name="variantStatus" id="variantStatus" type="checkbox" checked>'; } else if(halaga == "0"){ return '<input class="variantStatus" name="variantStatus" id="variantStatus" type="checkbox">'; } } var roleEventsBrand = { 'click :checkbox': function (e, value, row, index) { var get_id = row.id; $.ajax({ url:"app/brand_model/update_brand_status.php", method:"POST", data: {id: get_id, status: value}, success:function(data) { var $table = $('#brand-activation-table') $(function() { $table.bootstrapTable('refresh') }) refreshAddBrandDropdown(); refreshModifyBrandDropdown(); refreshModifyBrandList(); } }); } }; var roleEventsModel = { 'click :checkbox': function (e, value, row, index) { var get_id = row.id; $.ajax({ url:"app/brand_model/update_model_status.php", method:"POST", data: {id: get_id, status: value}, success:function(data) { var $table = $('#model-activation-table') $(function() { $table.bootstrapTable('refresh') }) } }); } }; var roleEventsVariant = { 'click :checkbox': function (e, value, row, index) { var get_id = row.id; $.ajax({ url:"app/brand_model/update_variant_status.php", method:"POST", data: {id: get_id, status: value}, success:function(data) { var $table = $('#variant-activation-table') $(function() { $table.bootstrapTable('refresh') }) } }); } }; function triggerClick(e) { image_is_clicked = 1; document.querySelector('#file').click(); } function displayImageBrand(e) { if (e.files[0]) { var reader = new FileReader(); reader.onload = function(e) { document.querySelector('#brand-image').setAttribute('src', e.target.result); } reader.readAsDataURL(e.files[0]); } var property = document.getElementById("file").files[0]; var brand_image_name = property.name; var image_extension = brand_image_name.split('.').pop().toLowerCase(); brand_form_data = new FormData(); brand_form_data.append('file', property); } function uploadImageBrand(image_name, brand_name){ var image_name = image_name; var new_brand_name = brand_name; $.ajax({ url:"app/brand_model/update_brand.php", type:"POST", dataType: 'json', data: { brand_id: modify_brand_id_selected, image_name: image_name, new_brand_name: new_brand_name, is_clicked: image_is_clicked }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.error("Brand name already existing"); return; } if(result.status == 1){ toastr.remove(); toastr.success("Brand details successfully updated"); refreshAddBrandDropdown(); refreshModifyBrandDropdown(); refreshModifyBrandList(); clearModificationTabBrand(); $('#modify-search-brand').val(""); $('#brand-image-div').hide(); $('#modify-model-list').html(''); $('#modify-variant-list').html(''); $('#details-update-brand').attr('disabled', true); clearModificationTabModel(); $('#details-update-model').attr('disabled', true); $('#modify-dd-models-brand').attr('disabled', true); $('#details-model-name').attr('disabled', true); return; } }, }) } </script> <script> $('#submit-brand').click(function(){ var new_brand = $('#new-brand-name').val(); if(new_brand == ""){ toastr.remove(); toastr.error('Brand field is empty'); return; } $.ajax({ url:"app/brand_model/add_brand.php", type:"POST", dataType: 'json', data: { new_brand: new_brand }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.warning(result.message); } else if(result.status == 1){ toastr.remove(); toastr.success("New Brand added successfully"); $('#new-brand-name').val(""); refreshAddBrandDropdown(); refreshModifyBrandList(); refreshModifyBrandDropdown(); } }, }); }); </script> <script> $('#details-update-brand').on('click', function(){ var update_brand_name = $('#details-brand-name').val(); //brand_form_data.append('file', modify_brand_id_selected); //brand_form_data.append('file', update_brand_name); if(modify_brand_id_selected == ""){ toastr.remove(); toastr.error("Please select brand to be modified"); return; } if(update_brand_name == ""){ toastr.remove(); toastr.error("Brand name is empty"); return; } $.ajax({ url: 'app/brand_model/upload_brand_image.php', method: "POST", data: brand_form_data, contentType: false, cache: false, processData: false, beforeSend: function(){ }, success: function(result){ uploadImageBrand(result, update_brand_name); } }); }) </script> <script> $('#details-update-model').click(function(){ var update_model_brand = $('#modify-dd-models-brand').val(); var update_model_name = $('#details-model-name').val(); //var update_model_description = $('#details-model-description').val(); if(modify_model_id_selected == ""){ toastr.remove(); toastr.error("Please select model to be modified"); return; } if(update_model_brand == ""){ toastr.remove(); toastr.error("Please identify " + update_model_name + "\'s brand"); return; } $.ajax({ url:"app/brand_model/update_model.php", type:"POST", dataType: 'json', data: { model_id: modify_model_id_selected, new_model_name: update_model_name, new_models_brand: update_model_brand //new_model_description: update_model_description }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.error("Model name already existing"); return; } if(result.status == 2){ toastr.remove(); toastr.success("Model details successfully updated"); //refreshModifyBrandList(); clearModificationTabModel(); clearModificationTabVariant(); $('#details-update-model').attr('disabled', true); $('#modify-dd-models-brand').attr('disabled', true); $('#details-update-variant').attr('disabled', true); $('#modify-dd-variants-model').attr('disabled', true); $('#modify-variant-list').html(''); return; } }, }) }) </script> <script> $('#details-update-variant').click(function(){ var update_variant_model = $('#modify-dd-variants-model').val(); var update_variant_name = $('#details-variant-name').val(); if(modify_variant_id_selected == ""){ toastr.remove(); toastr.error("Please select variant to be modified"); return; } if(update_variant_model == ""){ toastr.remove(); toastr.error("Please identify " + update_variant_name + "\'s model"); return; } $.ajax({ url:"app/brand_model/update_variant.php", type:"POST", dataType: 'json', data: { variant_id: modify_variant_id_selected, new_variant_name: update_variant_name, new_variants_model: update_variant_model }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.error("Variant name already existing"); return; } if(result.status == 2){ toastr.remove(); toastr.success("Variant details successfully updated"); refreshModifyModelList(); clearModificationTabVariant(); //$("#modify-brand-list").val('1761'); $('#details-update-variant').attr('disabled', true); return; } }, }) }) </script> <script> $('#modify-brand-list').on('change', function(){ $('#brand-image-div').show(); modify_brand_id_selected = $('#modify-brand-list').val(); $.ajax({ url:"app/brand_model/reload_brand.php", type:"POST", dataType: 'json', data: { brand_id: modify_brand_id_selected, type: 2 //get brand fields details }, beforeSend: function(){ }, success: function(result) { $('#details-brand-name').val(result.name); $('#details-brand-added-by').text(result.creator); $('#details-brand-date-added').text(result.date_added); $('#brand-image').attr('src', 'dist/img/brand/' + result.logo); $('#details-update-brand').attr('disabled', false); $('#details-brand-name').attr('disabled', false); refreshModifyModelList(); }, }) }); </script> <script> $('#modify-model-list').on('change', function(){ modify_model_id_selected = $('#modify-model-list').val(); $.ajax({ url:"app/brand_model/reload_model.php", type:"POST", dataType: 'json', data: { model_id: modify_model_id_selected, type: 2 //get brand fields details }, beforeSend: function(){ }, success: function(result) { $('#details-model-name').val(result.name); $('#modify-dd-models-brand').val(result.brand_id); $('#details-model-description').val(result.model_description); $('#details-model-added-by').text(result.creator); $('#details-model-date-added').text(result.date_added); $('#modify-dd-models-brand').attr('disabled', false); $('#details-model-name').attr('disabled', false); $('#details-update-model').attr('disabled', false); refreshModifyVariantList(); }, }) }); </script> <script> $('#modify-variant-list').on('change', function(){ modify_variant_id_selected = $('#modify-variant-list').val(); $.ajax({ url:"app/brand_model/reload_variant.php", type:"POST", dataType: 'json', data: { variant_id: modify_variant_id_selected, type: 2 //get variant fields details }, beforeSend: function(){ }, success: function(result) { $('#details-variant-name').val(result.name); $('#modify-dd-variants-model').val(result.model_id); $('#details-variant-added-by').text(result.creator); $('#details-variant-date-added').text(result.date_added); $('#modify-dd-variants-model').attr('disabled', false); $('#details-variant-name').attr('disabled', false); $('#details-update-variant').attr('disabled', false); }, }) }); </script> <script> $('#submit-model').click(function(){ var new_model_name = $('#new-model-name').val(); var new_models_brand = $('#add-dd-models-brand').val(); if(new_models_brand == ""){ toastr.remove(); toastr.error('Please select Model\'s brand first'); return; } if(new_model_name == ""){ toastr.remove(); toastr.error('Model name field is empty'); return; } $.ajax({ url:"app/brand_model/add_model.php", type:"POST", dataType: 'json', data: { new_model_name: new_model_name, new_models_brand: new_models_brand }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.warning(result.message); } else if(result.status == 1){ toastr.remove(); toastr.success("New Model added successfully"); $('#new-model-name').val(""); $('#new-model-description').val(""); $('#add-dd-models-brand').val("").trigger('change'); } }, }); }); </script> <script> $('#submit-variant').click(function(){ var new_variant_name = $('#new-variant-name').val(); var variants_brand = $('#add-dd-variants-brand').val(); var variants_model = $('#add-dd-variants-model').val(); if(variants_brand == ""){ toastr.remove(); toastr.error("Please select Variant\'s brand first"); return; } if(variants_model == ""){ toastr.remove(); toastr.error("Please select Variant\'s model first"); return; } if(new_variant_name == ""){ toastr.remove(); toastr.error("Variant name cannot be left blank"); return; } $.ajax({ url:"app/brand_model/add_variant.php", type:"POST", dataType: 'json', data: { new_variant_name: new_variant_name, brand: variants_brand, model: variants_model }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.warning(result.message); } else if(result.status == 1){ toastr.remove(); toastr.success("New Variant added successfully"); $('#new-variant-name').val(""); $('#add-dd-variants-brand').val("").trigger('change'); $('#add-dd-variants-model').val("").trigger('change'); } }, }); }); </script> <script> $('#add-dd-variants-brand').on('change', function(event){ var variant_brand_id = $('#add-dd-variants-brand').val(); $.ajax({ url:"app/cis/load_model.php", type:"POST", data: { brand_id: variant_brand_id }, beforeSend: function(){ }, success: function(result){ $('#add-dd-variants-model').html(''); $('#add-dd-variants-model').append("\"" + result + "\""); } }) }); </script> <script> $('#modify-search-brand').keyup(delay(function (e){ var search_modify_brand = $('#modify-search-brand').val(); brand_selected = ""; $.ajax({ url:"app/brand_model/reload_brand.php", type:"POST", //dataType: 'json', data: { type: 3, //populate brand list by search search_item: search_modify_brand }, beforeSend: function(){ }, success: function(result){ $('#modify-brand-list').html(''); $('#modify-brand-list').append("\"" + result + "\""); } }); }, 500)); </script> <script> $('#modify-search-model').keyup(delay(function (e){ if(modify_brand_id_selected != ""){ var search_modify_model = $('#modify-search-model').val(); model_selected = ""; $.ajax({ url:"app/brand_model/reload_model.php", type:"POST", //dataType: 'json', data: { type: 4, //populate model list by search search_item: search_modify_model, brand_id_selected: modify_brand_id_selected }, beforeSend: function(){ }, success: function(result){ $('#modify-model-list').html(''); $('#modify-model-list').append("\"" + result + "\""); } }); } }, 500)); </script> <script> $('#modify-search-variant').keyup(delay(function (e){ if(modify_model_id_selected != ""){ var search_modify_model = $('#modify-search-variant').val(); model_selected = ""; $.ajax({ url:"app/brand_model/reload_variant.php", type:"POST", //dataType: 'json', data: { type: 4, //populate model list by search search_item: search_modify_model, model_id_selected: modify_model_id_selected }, beforeSend: function(){ }, success: function(result){ $('#modify-variant-list').html(''); $('#modify-variant-list').append("\"" + result + "\""); } }); } }, 500)); </script> <script> //$('#modify-search-brand'). </script> <script> $('#custom-tabs-one-add-tab').click(function(){ clearModificationTabBrand(); clearModificationTabModel(); clearModificationTabVariant(); }); $('#custom-tabs-one-modify-tab').click(function(){ clearAddTabBrand(); clearAddTabModel(); }); $('#custom-tabs-one-settings-tab').click(function(){ clearModificationTabBrand(); clearModificationTabModel(); clearModificationTabVariant(); clearAddTabBrand(); clearAddTabModel(); refreshBrandTable(); refreshModelTable(); }); </script> <script> var shown = true; $(function() { $('#add-button').on("click", function() { shown ? $(this).hideBalloon() : $(this).showBalloon(); shown = !shown; }).showBalloon({ position: 'right', html: true, css: { color: 'black' }, contents: ` <div class="row"> <div class="col-sm-4 p-1"> <input style="width: 90px !important;" type="button" onclick="" id="add-brand" class="btn btn-primary btn-sm" value="Brand" data-toggle="modal" data-target="#modal-add-brand"></input> </div> <div class="col-sm-4 p-1"> <input style="width: 90px !important;" type="button" onclick="" id="add-model" class="btn btn-primary btn-sm" value="Model" data-toggle="modal" data-target="#modal-add-model"></input> </div> <div class="col-sm-4 p-1"> <input style="width: 90px !important;" type="button" onclick="" id="add-model" class="btn btn-primary btn-sm" value="Variant/Desc" data-toggle="modal" data-target="#modal-add-variant"></input> </div> </div> ` }); $('#add-button').hideBalloon(); shown = !shown; }); </script> </body> </html>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings