Changeset 370


Ignore:
Timestamp:
Oct 31, 2014 7:13:56 PM (11 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode/application/modules/admin/views
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/views/admin_acc.php

    r353 r370  
    6969                                                        });
    7070                                                </script>
     71                                                <?php
     72                                                if($this->session->flashdata('insert_error'))
     73                                                {
     74                                                        echo "Tên đăng nhập đã được sá»­ dụng !";
     75                                                }
     76                                                ?>
    7177                                                <div class="row">
    7278                                                        <div class="col-xs-12">
     
    7581                                                                        Thống kê tài khoản
    7682
    77                                                                         <button class="btn btn-success pull-right" data-toggle="modal" href="#addUser">
     83                                                                        <button class="btn btn-success pull-right" data-toggle="modal" href="#addAdmin">
    7884                                                                                <i class="icon-plus"></i>
    7985                                                                                Thêm quản trị viên
     
    184190                                                                </div>
    185191                                                               
    186                                                                 <!-- Edit User -->
     192                                                                <!-- Edit Admin -->
    187193                                                                <div tabindex="-1" class="modal fade in" id="editAdmin">
    188194                                                                        <div class="modal-dialog">
     
    198204                                                                       
    199205                                                                                        <div class="modal-body">
    200                                                                                                 <form method="post" class="form-horizontal" id="validation-edit-form" action="<?php echo $base_url; ?>admin/home/update">
     206                                                                                                <form method="post" class="form-horizontal" id="validation-edit-form" action="<?php echo $base_url; ?>admin/admin_account/update">
    201207                                                                                                        <input type="hidden" name="id" id="form-field-0" value="">
    202208                                                                                                        <div class="form-group">
     
    273279                                                                        </div>
    274280                                                                </div>
    275                                                                 <!-- End Edit User -->
     281                                                                <!-- End Edit Admin -->
    276282                                                               
    277                                                                 <!-- Delete User -->
     283                                                                <!-- Delete Admin -->
    278284                                                                <div tabindex="-1" class="modal fade in" id="deleteAdmin">
    279285                                                                        <div class="modal-dialog">
     
    289295                                                                                       
    290296                                                                                        <div class="modal-body">
    291                                                                                                 <form method="post" class="form-horizontal" id="validation-form" action="<?php echo $base_url; ?>admin/home/delete">
     297                                                                                                <form method="post" class="form-horizontal" id="validation-form" action="<?php echo $base_url; ?>admin/admin_account/delete">
    292298                                                                                                        <input type="hidden" name="id" id="form-field-0" value="">
    293299                                                                                                        <div class="form-group">
     
    336342                                                               
    337343                                                                <!-- Add User -->
    338                                                                 <div tabindex="-1" class="modal fade in" id="addUser">
     344                                                                <div tabindex="-1" class="modal fade in" id="addAdmin">
    339345                                                                        <div class="modal-dialog">
    340346                                                                                <div class="modal-content">
     
    349355
    350356                                                                                        <div class="modal-body">
    351                                                                                                 <form method="post" class="form-horizontal" id="validation-add-form" action="<?php echo $base_url; ?>admin/home/insert">
     357                                                                                                <form method="post" class="form-horizontal" id="validation-add-form" action="<?php echo $base_url; ?>admin/admin_account/insert" >
    352358                                                                                                        <div class="form-group">
    353359                                                                                                                <label for="form-field-1" class="col-sm-3 control-label no-padding-right"> Tài khoản </label>
    354                                                                                                                 <div class="col-sm-9">
     360                                                                                                               
     361                                                                                                                <div class="col-sm-9">
     362                                                                                                                       
    355363                                                                                                                        <label class="block clearfix has-error">
    356364                                                                                                                                <span class="input-icon">
     
    358366                                                                                                                                        <i class="icon-user blue"></i>
    359367                                                                                                                                </span>
    360                                                                                                                                 <div class="help-block"> </div>
     368                                                                                                                                <span style="" class="help-block" id="exist"><span>
     369                                                                                                                                <div class="help-block" id="usr" > </div>
    361370                                                                                                                        </label>
     371                                                                                                                       
    362372                                                                                                                </div>
    363373                                                                                                        </div>
     
    371381                                                                                                                                        <i class="icon-lock blue"></i>
    372382                                                                                                                                </span>
    373                                                                                                                                 <div class="help-block"> </div>
     383                                                                                                                               
     384                                                                                                                                <div class="help-block" id="pwd"> </div>
    374385                                                                                                                        </label>
    375386                                                                                                                </div>                 
     
    418429                                                                                                        <div class="clearfix form-actions">
    419430                                                                                                                <div class="col-md-offset-3 col-md-9">
    420                                                                                                                         <button type="submit" name="submit" class="btn btn-info">
     431                                                                                                                        <button id="insert-admin" type="submit" name="submit" class="btn btn-info">
    421432                                                                                                                                <i class="icon-ok bigger-110"></i>
    422433                                                                                                                                Hoàn tất
     
    438449                                                                </div>
    439450                                                                <!-- End Add User -->
    440 
     451                                                                <script>
     452                                                                        $('#addAdmin').on('show.bs.modal', function(e) {
     453                                                                                var isExist = false;
     454                                                                                $(e.currentTarget).find('input[name="username"]').bind('input', function(){
     455                                                                                        var username = $(this).val();
     456                                                                                        $.ajax({
     457                                                                                          url: "<?php echo $base_url; ?>admin/admin_account/check_data",
     458                                                                                          type: "POST",
     459                                                                                          data: 'username=' + username,
     460                                                                                          success: function(result){                     
     461                                                                                                                 if(result==="1"){
     462                                                                                                                        $('#exist').html("Tài khoản đã tồn tại !");
     463                                                                                                                        isExist = true;
     464                                                                                                                        $(e.currentTarget).find('input[name="username"]').focus();
     465                                                                                                                       
     466                                                                                                                        $('#insert-admin').click(function(){
     467                                                                                                                                $(e.currentTarget).find('input[name="username"]').focus();
     468                                                                                                                        });
     469                                                                                                                 }
     470                                                                                                                 else{
     471                                                                                                                        $('#exist').html("");
     472                                                                                                                 }
     473                                                                                                           }
     474                                                                                          });
     475                                                                                });
     476                                                                               
     477                                                                                $('#insert-admin').click(function(){
     478                                                                                        //$('#validation-add-form').valid();
     479                                                                                        var username = $('#username').val();
     480                                                                                        var password = $(e.currentTarget).find('input[name="password"]').val();
     481                                                                                        var fullname = $(e.currentTarget).find('input[name="fullname"]').val();
     482                                                                                        var email = $(e.currentTarget).find('input[name="email"]').val();
     483                                                                                        var phone = $(e.currentTarget).find('input[name="phone"]').val();
     484                                                                                        data = 'username=' + username + '&password=' + password + '&fullname=' + fullname + '&email=' + email + '&phone=' + phone;
     485                                                                                        if (isExist){
     486                                                                                                alert(isExist);
     487                                                                                        }
     488                                                                                       
     489                                                                                        if(username === "")
     490                                                                                        {
     491                                                                                                //alert("NULL");
     492                                                                                        }else
     493                                                                                        {
     494                                                                                                //alert(username);
     495                                                                                        }
     496                                                                                        /*
     497                                                                                        $.ajax({
     498                                                                                                url: "<?php echo $base_url; ?>admin/admin_account/insert",
     499                                                                                                type: "POST",
     500                                                                                                data: data,
     501                                                                                                success: function(result){                       
     502                                                                                                               
     503                                                                                                                }
     504                                                                                               
     505                                                                                          });
     506                                                                                        */
     507                                                                                });
     508                                                                        });
     509                                                                        /*
     510                                                                        $(document).ready(function() {
     511                                                                                $('#insert-admin').click(function(){
     512                                                                                        $('#validation-add-form').valid();
     513                                                                                        var username = $(this).val();
     514                                                                                        alert($username);
     515                                                                                        //location.href = "<?php echo $base_url; ?>admin/admin_account/insert";
     516                                                                                });
     517                                                                        });*/
     518                                                                </script>
    441519                                                                <!-- PAGE CONTENT ENDS -->
    442520                                                        </div><!-- /.col -->
Note: See TracChangeset for help on using the changeset viewer.